FAQ
Hi!
As per the http://blog.golang.org/pipelines, Done channel is used to close the other goroutines once the main returns. But as per the design spec, we don't have to wait for goroutines to close before returning from main as they will be eventually closed when there are no references. And also http://stackoverflow.com/questions/25518531/ok-to-exit-program-with-active-goroutine , says we don't have to close the goroutines ourselves.
My doubt is, Should we always close the running goroutines before exiting main? Thanks! Regards,
Bharath MG,
http://www.bharathmg.com

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Ian Lance Taylor at Jan 16, 2015 at 3:45 pm

    On Fri, Jan 16, 2015 at 12:52 AM, Bharath Mg wrote:
    As per the http://blog.golang.org/pipelines, Done channel is used to close
    the other goroutines once the main returns. But as per the design spec, we
    don't have to wait for goroutines to close before returning from main as
    they will be eventually closed when there are no references. And also
    http://stackoverflow.com/questions/25518531/ok-to-exit-program-with-active-goroutine
    , says we don't have to close the goroutines ourselves.

    My doubt is, Should we always close the running goroutines before exiting
    main? Thanks!
    If you are going to exit anyhow, don't worry about it.

    Arranging for clean shutdown of running goroutines is only important
    for a long-running program such as a network server.

    Ian

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJan 16, '15 at 3:05p
activeJan 16, '15 at 3:45p
posts2
users2
websitegolang.org

2 users in discussion

Bharath Mg: 1 post Ian Lance Taylor: 1 post

People

Translate

site design / logo © 2021 Grokbase