Even if it is true, it should be possible to restict the creation to some certain number of threads (even without reuse) and wait until at least one of these will finish the execution, before new ones are created/started. What if I program a server which should accomplish tasks, but with a maximum ammount of 1024 threads. Then a function get_thread should block, until one of executing threads becomes ready or terminates. Or do you think such a system should create unlimited number of threads? I will read tonight a little bit more how the threads in Solaris, Windows and other Unix Systems work (especiall in regards of creation). On the other hand on Solaris and where threads are cheap to create a new thread should be created by the pool anyway... With Kind Regards, Ovanes Markarian On Mon, August 7, 2006 14:52, John Reid wrote:
Ovanes Markarian wrote:
What I miss now in the threading library is the ability to reuse the thread. I think thread creation in the OS is an expensive task. If one has created thread, there should be a possiblity to reuse it. I understand it is possible to pass a function to the thread which executes tasks from the queue and therefore reuses threads, but this involves user implementation of such a function each time this programming pattern needs to be fullfilled.
If I remember correctly thread creation in Solaris at least is cheap and Sun's developer manuals explicitly recommend creating threads as needed rather than pooling them.
I'm not sure about other OSes. It might be worth checking before designing such a pool.
John.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users