Re: [Boost-users] How to manually lock and unlock a mutex?
You're not supposed to know about detail... :D
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Christian Henning Sent: Friday, July 29, 2005 11:29 AM To: boost-users@lists.boost.org 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
wrote: scoped_ptr would be more appropriate I think.
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Jason Stewart Sent: Friday, July 29, 2005 10:01 AM To: boost-users@lists.boost.org Subject: Re: [Boost-users] How to manually lock and unlock a mutex?
Try
void foo() { shared_ptr
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@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (1)
-
Sohail Somani