Boost logo

Boost Users :

From: Dhanvi Kapila (boostguy_at_[hidden])
Date: 2006-02-20 17:59:51


Kevin Heifner wrote:
> Dhanvi Kapila wrote:
>
>> So how you delete a lock ?? Is there any other safe way to delete a lock ?
>>
>
> I don't know what you are asking. Can you provide an example?
> Use the scoped lock concept. If you need to hide boost from the
> rest of the application then provide a wrapper around scoped lock
I need to hide boost locks from the rest of my code. I have a factory
class that creates locks ( we have ACE and Boost locks implemented).
to create the locks, in boost, we use the new keyword and to unlock (
release the lock ) we delete the locks. The mutex object using which the
locks are created are shared among the threads .

// create lock
//my_mutex is a mutex factory object with b_mutex as a public member of
type Boost::mutex
boost::mutex::scoped_lock* lk = new boost::mutex::scoped_lock(
my_mutex->b_mutex );

// deletion of lock
delete lk;

is this a correct way to do this ??

Thanks,
Dhanvi..


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