On Monday, February 13, 2017 at 7:02:22 AM UTC+1, Luka Napotnik wrote:
>
> I forgot to mention that the main goroutine in the test program is locked 
> to a thread as I call runtime.LockOSThread() in init()


The Go Spec <https://golang.org/ref/spec#Package_initialization> says 
"Package initialization—variable initialization and the invocation of init 
functions—happens in a single goroutine, sequentially, one package at a 
time. An init function may launch other goroutines, which can run 
concurrently with the initialization code.". The way I understand it, code 
in init() is not guaranteed to run in the same goroutine as main(), so you 
might be better of calling LockOSThread() from main() (or from whatever 
goroutine will do the GTK calls).

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

Reply via email to