|
Boost : |
From: Stefan Seefeld (seefeld_at_[hidden])
Date: 2008-05-28 09:17:01
Anthony Williams wrote:
> Stefan Seefeld <seefeld_at_[hidden]> writes:
>
>
>> David Abrahams wrote:
>>
>>> Seems to me that if we have "detach()," it we should be asking whether a
>>> thread is "attached()," rather than "joinable()." Our documentation
>>>
>>>
>> Agreed.
>>
>>
>>> says "if *this refers to a thread of execution..." all over it, which
>>> would seem to indicate that joinable() is an important question even
>>> when you're not about to join().
>>>
>>>
>> I find this phrasing a bit strange. 'thread of execution' sounds like a
>> concept.
>> Is the 'main' thread not a 'thread of execution' ? (And even if no
>> threads are spawned at all ?)
>>
>
> The 'main' thread us a thread of execution, even if no other threads
> have been spawned. You cannot obtain a boost::thread object that
> references it though.
>
I was looking for alternative ways to phrase the "Effects" (in
particular to express the "joinable" concept, but ran into some issues:
* There doesn't appear to be any means to query a thread object's state.
* I can (apparently) invalidate an existing thread object by detaching it.
* I can construct a thread that doesn't refer to anything (default
constructor).
Of course there is 'joinable', but that doesn't let me distinguish
between a default-constructed ("not-a-")thread, a detached thread, and a
thread that has already been joined.
Regards,
Stefan
-- ...ich hab' noch einen Koffer in Berlin...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk