Guest User

Untitled

a guest
Mar 17th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. void render_thread() {
  2. glfwMakeContextCurrent(win);
  3. while( !glfwWindowShouldClose(win) ) {
  4. sleep(10); // emulate heavy rendering, to be sure that main loop stops event processing during this sleep
  5. glfwSetWindowTitle(win, "some title"); // posts message? to window queue to update title
  6. }
  7. glfwMakeContextCurrent(nullptr);
  8. }
  9.  
  10. void main_thread() {
  11. set_thread_priority(highest); // to be sure this is first priority in OS sheduler, compared to render thread
  12. win = glfwCreateWindow(...);
  13. std::thread rt(&render_thread);
  14. while (!glfwWindowShouldClose(_glWindow))
  15. glfwWaitEvents(); // could put thread to sleep
  16. rt.join();
  17. }
Add Comment
Please, Sign In to add comment