Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-07-23 07:01:30


Howard Hinnant wrote:
>
> <soapbox>
> However we do not currently prohibit code such as the following:
>
> typedef mutex::scoped_lock MyMutex;
> mutex m;
> MyMutex my_mut(m, false);
>
> void foo()
> {
> my_mut.lock();
> }
>
> void bar()
> {
> my_mut.unlock();
> }
>
> int main()
> {
> foo();
> bar();
> }

No, a lock is not a mutex, because a mutex is inter-thread, and a lock is
thread-local (don't worry, I've been that same road myself, but Bill Kempf
enlightened me).


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