I'm not sure if this is the correct list to be posting this on, so
please let me know if you think it would be more useful somewhere
else.
I recently created an issue on github for the Go-OpenGL port, which
can be found here:
https://github.com/banthar/Go-OpenGL/issues/52.
In short, the problem is this:
If I mix goroutines with cgo calls to OpenGL (though I never call
OpenGL from these goroutines), I get segfaults deep inside of the
OpenGL implementation. Further examination with gdb shows that the
parameters are being passed to the OpenGL function's C-side entry
point exactly as I expect them to, but I get SIGSEGV anyway. Removing
goroutines from my program, despite them never touching OpenGL, fixes
the problem and the OpenGL code runs perfectly. I have also discovered
that calling runtime.LockOSThread() in the same goroutine that makes
all of the OpenGL (and GLEW, etc...) calls fixes the problem
completely, and goroutines can once again run free.
The link above contains more information about what I found and how I
found it, as well as some explanation of the thinking that lead me to
try runtime.LockOSThread() in the first place.
I am posting it here because the bug was not directly related to Go-
OpenGL (it happens if I call OpenGL directly from cgo), and seems more
to be a peculiarity of cgo interacting with go's scheduler. The fix I
posted causes the problem to go away, but I never found a satisfying
explanation for why the problem was occurring and hence I cannot be
sure that I've truly fixed it, rather than hiding it. I am hoping that
someone here might be able to produce such an explanation, or perhaps
suggest some other possibility for what went wrong.