glfwPollEvents on background thread

See this post on multithreading in GLFW and also see the GLFW documentation as each function description describes it’s thread safety.

The best approach is thus to keep GLFW event processing on the main thread and spawn work on other threads. Rendering can be moved to another thread using the context API. If desired you can use glfwWaitEvents on the main thread to block that thread until events are made available, and if you need to wake the main thread you can use glfwPostEmptyEvent to do so.

1 Like