Commit a3985e40 authored by Rob Pike's avatar Rob Pike

time: document that time.Tick creates an unrecoverable resource

Fixes #11662.

Change-Id: I8839b48a1cd3da4c29b6def03cb0c74c1c12942e
Reviewed-on: https://go-review.googlesource.com/12066Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 7c767fd7
......@@ -47,7 +47,9 @@ func (t *Ticker) Stop() {
}
// Tick is a convenience wrapper for NewTicker providing access to the ticking
// channel only. Useful for clients that have no need to shut down the ticker.
// channel only. While Tick is useful for clients that have no need to shut down
// the Ticker, be aware that without a way to shut it down the underlying
// Ticker cannot be recovered by the garbage collector; it "leaks".
func Tick(d Duration) <-chan Time {
if d <= 0 {
return nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment