|
Boost Users : |
Subject: [Boost-users] owns_lock on lock not on mutex
From: gast128 (gast128_at_[hidden])
Date: 2015-10-12 05:03:12
Hello all,
there is an owns_lock on the lock type but not on the mutex. This is quite
unhandy. Any reason why?
Use case is in base-derived idiom:
class Foo
{
public:
void Process()
{
boost::unique_lock<boost::mutex> lck(m_mtx);
Update();
}
protected:
void Update()
{
++m_n;
}
boost::mutex m_mtx;
int m_n;
};
class Bla : public Foo
{
public:
void Process()
{
boost::unique_lock<boost::mutex> lck(m_mtx);
Update();
}
private:
void Update()
{
assert(m_mtx.owns_lock());
++m_n2;
Foo::Update();
}
int m_n2;
};
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