Hi,
I’m trying for several days to find an error in my application, but I’m not able to solve it, maybe you can help me.
For the theory:
My application is built on two different threads.
The first thread does all rendering actions and control for the gameplay.
The second thread is loading objects and textures that could be soon needed for gameplay.
Through the second thread is not able to call openGL methods (needed i.e. to create textures) there is a “openGL-method-spool”. If the second thread wants to call an OpenGL method, it adds a request on the spool and waits for it to be done. Thread one will then (after each frame) look if there are any requests in the spool. If so, it handles them and continues.
So for example:
THREAD 1 THREAD 2
========================================================
Handle window messages - Nothing to do -
Render frame Request to load an object
SwapBuffers Load files from harddrive
Handle Spool Load files from harddrive
Handle window messages Add 'VBO-creation' to spool
Render frame - Wait for thread 1 -
SwapBuffers - Wait for thread 1 -
Handle Spool - Wait for thread 1 -
Handle window messages Continue working
and so on…
So far for the concept of my application.
But now one problem has come, since I activated the second thread. At critical sections (where the second thread loads a whole map) the first thread HANGS UP in the SwapBuffer method.
Through I give out many debug informations I could figure out, that Thread 1 always hangs up in SwapBuffer while the second thread randomly hangs up somewhere (in a spoon-waiting-request, because the handle-method in Thread 1 isn’t called anymore).
I can’t figure out what the reason could be - Do you maybe have any ideas?