12 Oct
2015
12 Oct
'15
9:03 a.m.
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_lockboost::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_lockboost::mutex lck(m_mtx); Update(); } private: void Update() { assert(m_mtx.owns_lock()); ++m_n2; Foo::Update(); } int m_n2; };