# glfwPollEvents on background thread

**URL:** <https://discourse.glfw.org/t/glfwpollevents-on-background-thread/1185>\
**Category:** support\
**Created:** [October 6, 2018, 3:32am UTC](https://discourse.glfw.org/t/glfwpollevents-on-background-thread/1185 "2018-10-06T03:32:29Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [October 6, 2018, 9:54am UTC](https://discourse.glfw.org/t/glfwpollevents-on-background-thread/1185/2 "2018-10-06T09:54:28Z")

</div>

See [this post on multithreading in GLFW](http://discourse.glfw.org/t/multithreading-glfw/573/5) and also see [the GLFW documentation](http://www.glfw.org/docs/latest/) 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](http://www.glfw.org/docs/latest/context_guide.html#context_current). If desired you can use [glfwWaitEvents](http://www.glfw.org/docs/latest/group__window.html#ga554e37d781f0a997656c26b2c56c835e) 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](http://www.glfw.org/docs/latest/group__window.html#gab5997a25187e9fd5c6f2ecbbc8dfd7e9) to do so.

---

_[View the full topic](https://discourse.glfw.org/t/glfwpollevents-on-background-thread/1185)._
