Hi,
in my multithraded application, I'm using a sleep() function (the one from the GLFW library):
glfwSleep(..);
and it apparently leads my application to segfaulting as my call stack shows:
#0 76CFC2BC WaitForSingleObjectEx() (C:\Windows\system32\kernel32.dll:??)
#1 00000016 ??() (??:??)
#2 0000006C ??() (??:??)
#3 00000000 ??() (??:??)
The glfwSleep()
is used inside a thread. Is that dangerous? Why is my program segfaulting as a consequence to that?
Edit:
When the parameter of the glfwSleep()
is < 0.02 (secs) it doesn't segfault!
Edit 2:
From the official documentation of GLFW :
Writing threaded applications may be very awkward before you get used to it, but there are a few key rules that are fairly simple to follow:
- ALWAYS assure exclusive access to data that is shared between threads!
- Make sure that threads are synchronized properly!
- NEVER busy wait!
I think i got my answer..have to find an alternative now..
Thanks!