Boost logo

Boost Users :

From: Sohail Somani (s.somani_at_[hidden])
Date: 2005-07-29 12:11:35


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 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