User:FIsherman

I will use this space until I figure out how to make new pages and stuff.

The threadpool
Naev has a global threadpool that is used to queue up jobs to be executed in parallel. It will try to create as many worker threads as there are CPUs. To do this it uses a SDL 1.3 feature. Most people do not have SDL 1.3 installed as it is not released yet. Instead of using an unavailable feature it defaults to 8 threads.

The queue
The queue used in threadpool.c has an important invariant: You have to get one permission from the associated semaphore or else stuff breaks.

The threadpool handler
I made a flowchart describing how it works:

Insert mode