Examples using... time.After()

Recent
After waits for the duration to elapse and then sends the current time on the returned channel. It is equivalent to NewTimer(d).C. The underlying Timer is not recovered by the garbage collector until the timer fires. If efficiency is a concern, use NewTimer instead and call Timer.Stop if the timer i...
This example passes a context with a timeout to tell a blocking function that it should abandon its work after the timeout elapses.
This example passes a context with an arbitrary deadline to tell a blocking function that it should abandon its work as soon as it gets to it.
Implementing timeouts in Go is easy and elegant thanks to channels and select.