Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-03-27 20:05:39


Howard Hinnant wrote:

> I can never get rid of another_mut, even after thread detach, even
> after:
>
> t = std::thread();
>
> I believe I'll even have to lock t.another_mut during the above move
> assign, making move assign unacceptably slow.

FWIW, an N2178 handle is not thread safe on assignment. It's as thread safe
as a pointer. (Calling functions with a handle as an argument is thread
safe, though.) So the equivalent of your vector insert example doesn't lock
anything (and, given a move constructor/assignment, shouldn't invoke O(N)
atomic ops).

This is a roundabout way to suggest that thread::operator= (and swap) should
also not be thread safe.


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