-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
time: stop time.Ticker when it is garbage collected #8001
Labels
Comments
FWIW, the documentation part was addressed by https://code.google.com/p/go/source/detail?r=7e130e3f9a4f |
Unfortunately, we can't stop a Ticker when it's GCed. A user can hold on to a copy of the timer from the Ticker and allow the Ticker to be garbage collected. In that case, we don't want to stop the Ticker. In fact, Tick does exactly that. As far as I know, there is no way to notice when the channel itself is destroyed (I don't mean a value of type chan, but the channel that backs it). Thus, I don't see any way of noticing when a Ticker isn't used anymore. |
I see, there's indeed a lot of complications here. Nevertheless, I think the documentation enhancement in https://code.google.com/p/go/source/detail?r=7e130e3f9a4f looks good. Hopefully, it can be incorporated in http://golang.org/pkg/time/#Ticker soon. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by awawfumin:
The text was updated successfully, but these errors were encountered: