Boost logo

Boost Users :

Subject: Re: [Boost-users] [thread] mutex is locked
From: I Do (mousehaohao_at_[hidden])
Date: 2014-06-26 07:59:52

can use this?

bool owns_lock() const;‍

------------------ Original ------------------
From: "gast128";<gast128_at_[hidden]>;
Date: Thu, Jun 26, 2014 07:46 PM
To: "boost-users"<boost-users_at_[hidden]>;

Subject: [Boost-users] [thread] mutex is locked

Dear all,

does anybody know if there is a possibility to check if a mutex is locked?
There is an 'owns_lock' on the lock type but not on the mutex.

The main use case for me is debugging (and documentation) purposes:

void MyClass::Process()
   boost::unique_lock<boost::mutex> lck(m_mtx);


void MyClass::ProcessImpl()
   _ASSERT(m_mtx.is_locked()); //does not exist :(

Boost-users mailing list

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at