Skip to content
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: Ticker.Stop() should close output channel #4366

Closed
reusee opened this issue Nov 8, 2012 · 2 comments

Comments

Projects
None yet
4 participants
@reusee
Copy link

commented Nov 8, 2012

What steps will reproduce the problem?
1. http://play.golang.org/p/lV4Ag-Fw_7
2.
3.

What is the expected output?
program should terminate normally

What do you see instead?
deadlock

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
linux

Which version are you using?  (run 'go version')
1.0.3

Please provide any additional information below.
@minux

This comment has been minimized.

Copy link
Member

commented Nov 8, 2012

Comment 2:

i think fixing this will change behavior of existing program (programs that don't
use comma ok form or range channel form to receive from channels)
The docs for it says:
Stop turns off a ticker. After Stop, no more ticks will be sent.
if we close the channel, i think it is almost equivalent to sending a new (zero) tick.
On the other hand, if we don't close the channel, this means uncollectable
garbage (if the user isn't using another form to notify tick's receiver goroutine,
but that will be rare).
FYI, we have a test in tick_test that verify after Stop(), we won't receive anything
from C.
http://tip.golang.org/src/pkg/time/tick_test.go#L28
@rsc

This comment has been minimized.

Copy link
Contributor

commented Nov 8, 2012

Comment 3:

Status changed to Duplicate.

Merged into issue #2650.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015

@rsc rsc removed the go1.1 label Apr 14, 2015

@golang golang locked and limited conversation to collaborators Jun 24, 2016

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.