S
SvenC
Hi Abubakar,
Why do you want to start/end/restart threads?
This sounds like a bad design.
Start threads to act as a thread pool that lives as long as your process
needs the threads to do their work.
A typical design pattern is that the thread function is waiting in a loop
on some object to be signalled. When signalled it might read some
arguments from a task queue to process that task. One task or one
signal would be an indicator that the process need to shut down and
the thread should leave its loop.
An efficient signal/queue technique are windows IO completion ports.
Use google or msdn to get the details.
Hi all,
I'm using WaitForMultipleObjects, I give an array of handles and give
it FALSE in bWaitAll param. What I want to do is, I spawn few threads
upto N, than I wait for any of them to end, when any one or more of
them ends, I want to spawn as many threads as were ended.
Why do you want to start/end/restart threads?
This sounds like a bad design.
Start threads to act as a thread pool that lives as long as your process
needs the threads to do their work.
A typical design pattern is that the thread function is waiting in a loop
on some object to be signalled. When signalled it might read some
arguments from a task queue to process that task. One task or one
signal would be an indicator that the process need to shut down and
the thread should leave its loop.
An efficient signal/queue technique are windows IO completion ports.
Use google or msdn to get the details.