Boost logo

Boost Users :

From: Sohail Somani (s.somani_at_[hidden])
Date: 2005-07-29 16:57:06


You're not supposed to know about detail... :D

> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of
> Christian Henning
> Sent: Friday, July 29, 2005 11:29 AM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] How to manually lock and unlock a mutex?
>
>
> Seems to me that I should take a look at the detail folder in
> the thread lib. ;-)
>
> Thanks you all for helpful suggestions,
> Christian
>
> On 7/29/05, Sohail Somani <s.somani_at_[hidden]> wrote:
> > scoped_ptr would be more appropriate I think.
> >
> > > -----Original Message-----
> > > From: boost-users-bounces_at_[hidden]
> > > [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Jason
> > > Stewart
> > > Sent: Friday, July 29, 2005 10:01 AM
> > > To: boost-users_at_[hidden]
> > > Subject: Re: [Boost-users] How to manually lock and
> unlock a mutex?
> > >
> > >
> > > Try
> > >
> > > void foo()
> > > {
> > > shared_ptr<scoped_lock> lk;
> > > if (condition)
> > > lk.reset(new scoped_lock(mutex));
> > >
> > > do something
> > > }
> > >
> > > The smart pointer will automatically unlock when it goes out of
> > > scope.
> > >
> > > _______________________________________________
> > > Boost-users mailing list
> > > Boost-users_at_[hidden]
> > > http://lists.boost.org/mailman/listinfo.cgi/boost-users
> > >
> >
> > _______________________________________________
> > Boost-users mailing list
> > Boost-users_at_[hidden]
> > http://lists.boost.org/mailman/listinfo.cgi/boost-users
> >
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net