
23 Jul
2004
23 Jul
'04
12:01 p.m.
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).