Timers allow you to execute one event in the future. You tell the timer how long you want to wait and it provides a channel to be notified at that time. The first timer will wait for 3 seconds.
<-firstTimer.C blocks the timer C channel until a message (current time) is sent indicating that the timer has expired.
If you just want to wait, you can use time.Sleep. One reason a timer can be useful is that you can cancel the timer before it expires.
The first timer expires 3s after the program starts, but the second is stopped before it expires.
Snippets39
Categories0
Tags50
Users3