Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-03-26 16:08:35

Howard Hinnant wrote:

> However I don't want to add cost to support idioms which are
> inherently unsafe in the pthread model anyway, for example:
> std::thread t(f); // global
> thread A thread B
> t.join() t.cancel()
> In pthreads this is a race.

Right. It's not a race if thread::join is const, though. Or stated
differently, given a 'const' join, making the above well-defined adds no
additional overhead, at least in my implementation (copyability doesn't
matter here).

> If an implementation of std::thread happens to tolerate
> this race, I have no problem with that.

I think I'd certainly have a problem with that were I you. This silently
makes the Windows program non-portable to Mac OS X.

Boost list run by bdawes at, gregod at, cpdaniel at, john at