Re: [Boost-users] [Threads] Problem with starting a sub thread

Thanks for the quick answers. I understood and experienced that the main thread blocks. But how can it join other threads, if it is blocked? That doesn't seem consistent to me. Torsten
Hi!
join cause a calling thread to block until the second one is finished. This is
also stated in the
docs: 1.void join(); Requires: *this is joinable. !!!!!Effects: The current thread of execution blocks until the initial function of the thread of execution represented by *this finishes and all resources are reclaimed. Notes: If *this == thread() the result is implementation-defined. If the implementation doesn't detect this the result will be deadlock.

Goroll, Torsten wrote:
Thanks for the quick answers.
I understood and experienced that the main thread blocks. But how can it join other threads, if it is blocked? That doesn't seem consistent to me.
That is what "join with thread T" means, "block until T has ended". It's not clear what you mean by "not consistent", consistent with what? What would you expect join to do if it doesn't block? If you don't want the main thread to block waiting for T to end, then don't call join.
participants (2)
-
Goroll, Torsten
-
Peter Dimov