Closed Ramh5 closed 5 years ago
The exception means what it is saying: You are calling glfwInit
in a thread other than the main thread. By definition, the main thread is the thread which initially calls your public static void main(String[] args)
method. Somewhere in your code you are instantiating a new Thread and give it the name GAME_LOOP_THREAD
.
While calling GLFW methods (such as glfwInit
and glfwCreateWindow
) in threads other than the main thread may work on Windows, it will definitely fail on Mac OS. The debug agent makes sure a program will work on all OS'es. And calling glfwInit
will not work on Mac OS.
See the documentation of the GLFW functions, such as glfwInit
(https://www.glfw.org/docs/latest/group__init.html#ga317aac130a235ab08c6db0834907d85e ) and look under the section "Thread safety".
Thanks for the quick reply, we can close this question since I understand it is more a feature than a bug. As I knew what the GLFWInit documentation required it to run on the main thread, the code I got from a tutorial book is written like and is working on windows so I thought it was fine. I was more intrigued by the fact that it didn't work with the debug too activated. Now would it be desirable or even possible to have this debug tool only give you a warning that the code might not work on MacOS instead of crashing it?
Cheers.
Now would it be desirable or even possible to have this debug tool only give you a warning that the code might not work on MacOS instead of crashing it?
Yes, there is the nothrow
Option. Please see the README.md of this project.
Great many thanks for this tool.
My project works but when I add the agent to the vm arguments in eclipse, it seems to change the main thread and I get the following stack trace. Is it possible that using this debug tool changes my main thread so that my glfwInit is now called in another thread? Is there a way to fix that in my code?