in reply to Re: Thread Exit Status
in thread Thread Exit Status
First off, you don't want to join threads in the same order that you created them.
Why not when the only other thing he's got to do is wait for another thread, or exit?
Even if all 9 other threads finish before the first one he attempts to join, it'll only take .04 of a second to join the other 9 before he exits.
It only becomes important to join threads in the order they finish if you've got another thread to start as soon as the first is finished. In which case using a pool of threads is better anyway.
The downside is figuring out how to wait until some thread is ready (maybe yield()?)
yield is a very bad bad way of waiting. Yielding in a tight loop will consume prodigious amount of cpu. It is the ultimate busy loop.
there's a fairly good chance you'll get better performance without threads than with them.
I'll rise to that challenge. Will you?
|
|---|