Subj : Re: Futexes are wrong! (Are they?) To : comp.programming.threads From : Maciej Sobczak Date : Wed Jun 08 2005 12:15 am David Schwartz wrote: >>now the question is about what >>programming style we should promote to benefit from potential performance >>gain without surprising those who happen to read the code. > > Easy. > > { > scoped_lock h(mutex, condvar); > // do stuff > h.Unlock(); > h.Signal(); > } Which completely defeats the purpose of scoped_lock. The above can be written in the following way with the same set of pros and cons: { mutex.lock(); // do stuff mutex.unlock(); condvar.signal(); } But I take the oppostunity to push your idea in the following direction: { scoped_signalling_lock lock(mutex, condvar); // do stuff } The destructor of lock is supposed to do "the right thing". -- Maciej Sobczak : http://www.msobczak.com/ Programming : http://www.msobczak.com/prog/ .