-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examples assume they run on a single thread #16
Comments
There is this page that can be linked from README https://github.com/golang/go/wiki/LockOSThread . SDL bindings has this helper veandco/go-sdl2@bc9d5d1 with some examples how to use it https://github.com/veandco/go-sdl2/blob/master/examples/render_goroutines/render_goroutines.go but now sure if that can work here, will need some time to test. |
An alternative to the helper would be to create a e: thinking on it a bit, I think it should be possible to fork and lock a thread in |
@gen2brain |
Raylib drawing commands aren't thread-safe - which isn't a huge deal, since OpenGL isn't to begin with - but since the examples don't lock an OS thread, drawing commands could potentially be issued on a different thread after garbage collection (as in this issue).
The quick and dirty way of fixing this would be to manually call
runtime.LockOSThread
in the examples. However, this seems like a common enough gotcha with Go and graphics libraries that it might be a good idea to handle it in the binding somehow - possibly by providing a mainthread-style helper?The text was updated successfully, but these errors were encountered: