diff options
| author | Brad Fitzpatrick <bradfitz@golang.org> | 2016-05-20 22:43:14 +0000 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2016-05-20 22:51:51 +0000 |
| commit | 7ab698b0221fd4a5b2842fb50a34ba8a5f49c6d5 (patch) | |
| tree | 7bfe39d0b83fc9ac90c1b4a05d8eacd773d98dbd /src | |
| parent | 054a721dcac9b30610af0898b3ed8bf3ffa9f8b1 (diff) | |
| download | go-7ab698b0221fd4a5b2842fb50a34ba8a5f49c6d5.tar.xz | |
time: document that After uses memory until duration times out
Fixes #15698
Change-Id: I616fc06dcf04092bafdaf56fb1afba2a998a6d83
Reviewed-on: https://go-review.googlesource.com/23304
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/time/sleep.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/time/sleep.go b/src/time/sleep.go index c348366604..7661f7e54f 100644 --- a/src/time/sleep.go +++ b/src/time/sleep.go @@ -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 } |
