Does the glutTimerFunction work on a thread separate from the main thread when it is executed? Used to call the function that encapsulates it, when it calls that parent function it does not immediately get placed in a stack. I mean the line proceeding glutTimerFunc is then executed before the next call to the parent function is executed. I thought in a recursive function the line proceeding the call to the function is not executed until the base case is satisfied. Why is this or how is this working in the background? What is the voodoo behind the glutTimerFunction?
glutTimerFunc question
There's nothing spectacular about it. It starts a timer, and when the timer expires, GLUT event loop issues a call to the timer callback. No additional threads are needed or used. It probably uses OS-specific timer events, and when the OS notifies GLUT that the timer has expired, GLUT responds by calling your callback.
When you say "GLUT even loop issues a call to the timer callback", do you mean the GLUT event loop calls the parent function that encapsulates the glutTimerFunction?
It's not very clear what you mean by parent function. When you call glutTimerFunc() you pass it a function pointer. When the GLUT main loop notices the requested amount of time has passed it calls that function pointer.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement