Added method to retrieve the name of the Thread currently owning a Mutex.

git-svn-id: http://yate.null.ro/svn/yate/trunk@3022 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2010-01-16 20:42:25 +00:00
parent 66b8ce7ca2
commit 8ed8bd3095
2 changed files with 13 additions and 0 deletions

View File

@ -70,6 +70,8 @@ public:
{ return m_recursive; }
inline const char* name() const
{ return m_name; }
inline const char* owner() const
{ return m_owner; }
bool locked() const
{ return (m_locked > 0); }
bool lock(long maxwait);
@ -574,6 +576,11 @@ bool Mutex::locked() const
return m_private && m_private->locked();
}
const char* Mutex::owner() const
{
return m_private ? m_private->owner() : static_cast<const char*>(0);
}
int Mutex::count()
{
return MutexPrivate::s_count;

View File

@ -3705,6 +3705,12 @@ public:
*/
virtual bool locked() const;
/**
* Retrieve the name of the Thread (if any) holding the Mutex locked
* @return Thread name() or NULL if thread not named
*/
const char* owner() const;
/**
* Check if this mutex is recursive or not
* @return True if this is a recursive mutex, false for a fast mutex