From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-08-25 15:41:57
> I've explained this before. When linking with other libraries (both
> C and C++) it's quite possible that the library has created threads
> using the "native" means, POSIX in this case. These libraries can
> call back into code that calls boost::thread() (or equivalent "self"
Yes, I understand that. My question was, why do you consider this a major
issue? Will users expect that, in a situation like the above -- a callback
invoked from a library that uses native threading -- they ought to be able
to use Boost.Threads functionality? How common would this situation be?
> At this point the thread must either be adopted, or
> you must indicate some sort of error, and the only option that's
> likely to be acceptable to users is to adopt the thread.
I see two other options.
(1) "The behavior of current() invoked from a thread that has not been
created by create() and is not the main thread is implementation defined."
(2) "A call to current() from a thread that has not been created by create()
and is not the main thread invokes undefined behavior."
> the "initial thread", as you've pointed out, is a thread created from
> outside of Boost.Threads and so a thread that must be adopted.
The initial thread is an exception. It is under the control of the
implementation, whereas threads created by a third-party library calling
pthread_create() are not.
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk