]> Cypherpunks repositories - gostls13.git/commitdiff
time: document that After uses memory until duration times out
authorBrad Fitzpatrick <bradfitz@golang.org>
Fri, 20 May 2016 22:43:14 +0000 (22:43 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 20 May 2016 22:51:51 +0000 (22:51 +0000)
Fixes #15698

Change-Id: I616fc06dcf04092bafdaf56fb1afba2a998a6d83
Reviewed-on: https://go-review.googlesource.com/23304
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/time/sleep.go

index c348366604e6dbe33b8910d4e2a86b4f077094a2..7661f7e54fc1302f8d1e1e5f2a1365127cbac8f8 100644 (file)
@@ -106,6 +106,9 @@ func sendTime(c interface{}, seq uintptr) {
 // 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 is no longer needed.
 func After(d Duration) <-chan Time {
        return NewTimer(d).C
 }