Boost logo

Boost :

From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2008-05-28 04:57:24


Johan Torp <johan.torp_at_[hidden]> writes:

> IIRC, windows thread ids can be re-used. That is, if you stop a thread X and
> later start a thread Y they might get the same thread id. Is this the case
> with boost.thread? What about the standard? It states:
>
> "An object of type thread::id provides a unique identifier for each thread
> of execution and a single distinct value for all thread objects that do not
> represent a thread of execution ([thread.threads.class]). Each thread of
> execution has a thread::id that is not equal to the thread::id of other
> threads of execution and that is not equal to the thread::id of std::thread
> objects that do not represent threads of execution."
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2497.html#thread.threads.id
>
> Which sounds like thread ids are free to be re-used.

std::thread::id values may be reused by new threads.

boost::thread::id values are not reused by new threads until the
thread has terminated, and there is no boost::thread object or
boost::thread::id objects referring to that thread (they are reference
counted).

Anthony

-- 
Anthony Williams            | Just Software Solutions Ltd
Custom Software Development | http://www.justsoftwaresolutions.co.uk
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk