Original Post
I have an idea for a system, but I am not sure of the best/feasable ways to implement it. I haven't made much headway in reading web-based threading resources, and wondered if any of you could give me a few pointers... Basically, I want to run 3-4 threads concurrently, each performing a different part of the same task (there are no shared resources to worry about). So, I want to start all 3 threads, which each perform certain tasks each frame. The frame is done when all 3 finish running, and then the 1st thread will perform bookkeeping, etc., after which it will start the next frame by resuming each of the threads. So basically, I need to spawn 2 additional threads, wait until all 3 threads are done, and then start them again after bookkeeping in the initial thread. I realise that may not be the clearest explanation, so tell me if it needs clarification. It looks to me as if this could be done with either conditional variables, or with a semaphore. Am I correct in this, and would one have huge benefits over the other? Also, while the implementation using semaphores seems straight forward, I am still not clear how this would be done using conditional variables?