Boost logo

Boost :

From: bill_kempf (williamkempf_at_[hidden])
Date: 2002-01-31 15:10:09


--- In boost_at_y..., Iain.Hanson_at_u... wrote:
>
> Author: david.abrahams (david.abrahams_at_r...) at unix,mime
> Date: 31/01/02 19:09
>
>
> >...so you give newbies a "safe_mutex" on which scoped_lock works
and for
> >which there are no lock/unlock functions? Maybe I'm just getting
hung up on
> >the principle of the thing. After all, even experts are likely to
use
> >scoped_lock most often.
>
> One of the things that most concerns me with the totally safe
interface is
> that if I want to unlock the mutex early and then re-aquire it
later I
> can't.

This isn't true. The Scoped Lock classes provide the ability to
unlock and then later lock the mutex. This covers the _vast_
majority of uses (and probably _all_ of the issues that the
proverbial "newbie" is going to need). The only limitation is the
scoped nature of the lock, which prevents efficient lock patterns for
things such as a lock_ptr<>. That's what the "traits" approach is
supposed to address, though.

> I have to create two mutex's :-( with all the extra complication
that
> entails in other functions .

I can not envision any case in which this would be the case (even
with out the traits). Can you post an example?

Bill Kempf


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