Re: [go-nuts] Are all running goroutines killed when main ends?

2017-10-07 Thread David Collier-Brown
On Friday, October 6, 2017 at 9:49:18 AM UTC-4, Michael Jones wrote: > > Imagine the slightly stronger notion of a "will" as in a person's last > will and testament. Actions in your will are steps to be carried out in the > event of your death. Presumably if an action has already been done

Re: [go-nuts] Are all running goroutines killed when main ends?

2017-10-07 Thread Michael Jones
Agree with Lucio and Bakul on each point. It is not something I need...just raising the observation that one could imagine "defer until even later" and it is an interesting thought experiment. On Sat, Oct 7, 2017 at 1:59 AM, Bakul Shah wrote: > > If a process is killed by

Re: [go-nuts] Are all running goroutines killed when main ends?

2017-10-07 Thread Bakul Shah
If a process is killed by the kernel for some reason (or kill -9) none of these cleanup functions will run. The last will idea is meaningful only when the main() dies and doesn't care to wait for all the other goroutines to die a clean death. But in this case you are in essence passing a

Re: [go-nuts] Are all running goroutines killed when main ends?

2017-10-07 Thread Lucio
On Friday, 6 October 2017 15:49:18 UTC+2, Michael Jones wrote: > > Imagine the slightly stronger notion of a "will" as in a person's last > will and testament. Actions in your will are steps to be carried out in the > event of your death. Presumably if an action has already been done during >

Re: [go-nuts] Are all running goroutines killed when main ends?

2017-10-06 Thread Michael Jones
This line of reasoning suggests an idea to me. Defer has the grammatical notion of "i want to do this later, but eventually, i don't want to forget to do it before i leave." Imagine the slightly stronger notion of a "will" as in a person's last will and testament. Actions in your will are steps

Re: [go-nuts] Are all running goroutines killed when main ends?

2017-10-06 Thread Mikhail Mazurskiy
I wrote a library to help with this https://github.com/ash2k/stager -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For

Re: [go-nuts] Are all running goroutines killed when main ends?

2017-10-06 Thread go-question
Thanks for clearing that up! On Thursday, October 5, 2017 at 9:52:30 PM UTC-7, Dave Cheney wrote: > > The only answer I have is to ask those goroutines to exit, the wait for > them to exit. Context is part of this, combined with a waitgroup to track > goroutines in flight. -- You received

RE: [go-nuts] Are all running goroutines killed when main ends?

2017-10-05 Thread Dave Cheney
The only answer I have is to ask those goroutines to exit, the wait for them to exit. Context is part of this, combined with a waitgroup to track goroutines in flight. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

RE: [go-nuts] Are all running goroutines killed when main ends?

2017-10-05 Thread John Souvestre
Any easy way to make their defers run? John John Souvestre - New Orleans LA -Original Message- From: golang-nuts@googlegroups.com [mailto:golang-nuts@googlegroups.com] On Behalf Of Dave Cheney Sent: 2017 October 05, Thu 23:36 To: golang-nuts Subject: [go-nuts] Are all running

Re: [go-nuts] Are all running goroutines killed when main ends?

2017-10-05 Thread Ian Lance Taylor
On Thu, Oct 5, 2017 at 8:09 PM, go-question wrote: > > When a program's main ends, will all running goroutines that were created by > the program also be stopped and cleaned up? Yes. Ian -- You received this message because you are subscribed to the Google Groups