Boost logo

Boost :

From: Rainer Deyke (root_at_[hidden])
Date: 2002-01-31 14:49:25


----- Original Message -----
From: <Iain.Hanson_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, January 31, 2002 12:23 PM
Subject: Re: [boost] Re: mutex_traits<>

>
> Author: david.abrahams (david.abrahams_at_[hidden]) 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.

{
  auto_ptr<scoped_lock> guard = new scoped_lock;
  // locked
  guard = 0;
  // unlocked
  guard = new scoped_lock;
  // locked again
} // automatically unlocked as 'guard' leaves scope

--
Rainer Deyke | root_at_[hidden] | http://rainerdeyke.com

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