thread.d "Unable to load thread context"

Benjamin Thaut code at benjamin-thaut.de
Tue Jun 28 06:47:12 PDT 2011


I'm my current project, which is a relatime 3d space shooter I'm using a 
lot of C libraries (SDL, OpenGL, OpenAL, SDL_Image, Assimp, etc.)
As the gc would take to much time when it runs only once in a while I'm 
performing a full collect after a frame has been rendered.
Now once in a while, sometimes after 30 seconds, sometimes after 20 
minutes, the D runtime throws the "Unable to load thread context" 
exception. My debugger tells me that the main thread is currenlty 
performing a full collection when that happens.
A few other threads are waiting for single or multiple objects (on 
windows that is). A OpenGL thread runs the 
ntdll!ZwQueryInformationThread (I'm using a nvidia card so it's the 
nvidia OpenGL implementation) and one of my threads waits for a 
semaphore with a tryWait.

My application runs 3 thraeds.
-A main thread where the renderer runs in. This thread makes all the 
OpenGL calls.
-A extractor thread that extracts relevant data for the renderer from 
the game thread.
-The game thread that actually performs the game simulation. This thread 
makes calls to the OpenAL api.

Now I'm wondering why this happens. Is this connected to OpenGL?
Is it not a good idea to call the gc collect manually?
Isthe thread that is waiting for the semaphore the problem?

Any help would be appreciated.
-- 
Kind Regards
Benjamin Thaut


More information about the Digitalmars-d mailing list