
15 May
2008
15 May
'08
1:47 p.m.
Axel wrote:
I m writting a program which create threads following commands received on a socket connection. When exiting, I'd like to wait that all dynamically created threads have ended their jobs. I thought about using a shared variable (with mutual exclusion) that threads would increment at start and decrement at end. And then the program would stop, loop on sleep() while this shared variable is still > 0.
Is there a better way to wait for the end of threads ?
You could join all the threads. http://www.boost.org/doc/libs/1_35_0/doc/html/thread/thread_management.html#... KevinH -- Kevin Heifner heifner @ ociweb.com http://heifner.blogspot.com Object Computing, Inc. (OCI) www.ociweb.com