
26 Mar
2007
26 Mar
'07
8:08 p.m.
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.