BurntSushi / xgbutil

A utility library to make use of the X Go Binding easier. (Implements EWMH and ICCCM specs, key binding support, etc.)
Do What The F*ck You Want To Public License
195 stars 45 forks source link

unsafe quitting mechanism #9

Open BurntSushi opened 11 years ago

BurntSushi commented 11 years ago

From Nigel Tao:

I just wanted to note, though, that:

Goroutine A: xu.Quit = true

Goroutine B: for { if xu.Quit { return } // etc. }

isn't guaranteed to work. See http://golang.org/ref/mem, especially the part that says "another incorrect idiom is busy waiting for a value".