FAQ
Is is safe to disable a select case (set channel to nil) from another
goroutine? Seems like it probably isn't, but I'd like to get verification.
I threw together a little example here: http://play.golang.org/p/6yW8hviExR

Thanks!

--
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

  • Dan Kortschak at Mar 30, 2014 at 3:35 am
    You are right to be concerned, there is no synchronisation for that, but
    you should ask your best friend here:

    $ go run -race race.go
    stuffing buffer
    10 buffer full
    buffer stuffed
    ==================
    WARNING: DATA RACE
    Read by goroutine 3:
       main.(*Foo).print()
           /home/xxxxx/race.go:39 +0xa7

    Previous write by main goroutine:
       main.(*Foo).Close()
           /home/daniel/race.go:72 +0xdd
       main.main()
           /home/xxxxx/race.go:90 +0x313

    Goroutine 3 (running) created at:
       main.NewFoo()
           /home/xxxxx/race.go:30 +0x11a
       main.main()
           /home/xxxxx/race.go:82 +0x36
    ==================
    Found 1 data race(s)
    exit status 66

    On Sat, 2014-03-29 at 19:44 -0700, andrew.bursavich@gree.co.jp wrote:
    Is is safe to disable a select case (set channel to nil) from another
    goroutine? Seems like it probably isn't, but I'd like to get
    verification. I threw together a little example
    here: http://play.golang.org/p/6yW8hviExR


    --
    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
postedMar 30, '14 at 2:45a
activeMar 30, '14 at 3:35a
posts2
users2
websitegolang.org

2 users in discussion

Andrew Bursavich: 1 post Dan Kortschak: 1 post

People

Translate

site design / logo © 2021 Grokbase