Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
time: Ticker.Stop() should close output channel #4366
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.
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