1
0
mirror of https://github.com/golang/go synced 2024-11-23 16:00:06 -07:00

time: explicitely mention Tickers have to be stopped

LGTM=rsc
R=golang-codereviews, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/64770043
This commit is contained in:
Patrick Mézard 2014-02-24 10:18:40 -05:00 committed by Russ Cox
parent f12a167ba2
commit 7403071ada

View File

@ -17,6 +17,7 @@ type Ticker struct {
// time with a period specified by the duration argument.
// It adjusts the intervals or drops ticks to make up for slow receivers.
// The duration d must be greater than zero; if not, NewTicker will panic.
// Stop the ticker to release associated resources.
func NewTicker(d Duration) *Ticker {
if d <= 0 {
panic(errors.New("non-positive interval for NewTicker"))