
28 Mar
2007
28 Mar
'07
12:05 a.m.
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.