|
Boost Users : |
From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2005-01-03 11:48:46
Peter Dimov wrote:
> pthread_self gives you a full pthread_t, which you can use as input to
> pthread_join, pthread_cancel, pthread_setschedparam; you can also give
> this pthread_t to another thread and it remains valid.
>
Is this even true after having detached a thread?
Is it still valid to join a thread by means of a thread id that has been
obtained with pthread_self after the
thread has been detached?
> boost::thread::thread() doesn't give you a boost::thread*, the
> boost::thread surrogate it creates is valid only within the current
> thread, and it can only be compared to another boost::thread.
>
As long as the boost::thread has not been "delete"ed (the equivalent of
detach) you are free to use the boost::thread* from
any other thread you like.
> pthread_self "always works"; it does not depend on some user not
> destroying a boost::thread object. A boost::thread* in thread-specific
> storage does not have this property.
This is indeed an interesting question I would like to know the answer.
Again: does "alqays" imply "even after having been detached"?
I suspect, that boost::thread* behaves almost identical to pthread_t in
a semantical sense.
Roland
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net