Boost logo

Boost :

From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2006-11-01 14:34:41

Peter Dimov wrote:
> Indeed, sorry for not paying attention. But the only point of locking a
> mutex is to be able to do that from two different threads at the same time.
> If you know that only one thread is accessing the scoped_lock at a time, you
> wouldn't need a scoped_lock in the first place.

Could you please provide an example where it is not possible to
solve the problem with scoped_lock only? I simply cannot find
one. Currently this would be the only "killer argument" for my
proposed aggregate/POD type mutex. Therfore I am very interested
in this.

> .... Sometimes you just need to lock the mutex in one place and unlock
> it in another, and there is no way around it.

Are you thinking the following kind of scenario?

void foo() {
        scoped_lock lk(mx);

void bar(scoped_lock& lk)


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