|
Boost Users : |
Subject: Re: [Boost-users] using a boost::shared_mutex in a share_ptr
From: Igor R (boost.lists_at_[hidden])
Date: 2011-11-01 05:37:27
> I have the following variable declared in a class:
>
> Boost::shared_ptr<boost;:shared_mutex>
>
> If I have a standard boost::shared_mutex, I can pass this to a shared or
> unique lock.
>
> How do I pass a boost::shared_ptr<boost::shared_mutex> to a lock?
>
> This is probably really simple, but I carnât fathum it out!
#include <boost/thread/locks.hpp>
#include <boost/thread/shared_mutex.hpp>
#include <boost/shared_ptr.hpp>
int main()
{
using namespace boost;
shared_ptr<shared_mutex> pMutex;
unique_lock<shared_mutex> lock(*pMutex);
}
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