Home | History | Annotate | Download | only in common

Lines Matching refs:Mutex

1 //===-- Mutex.cpp -----------------------------------------------*- C++ -*-===//
10 #include "lldb/Host/Mutex.h"
27 // Enable extra mutex error checking
59 // Make sure this isn't already in our initialized mutex set...
63 // Add the mutex to the initialized set
68 // Make sure this isn't already in our destroyed mutex set...
72 // Add the mutex to the destroyed set
76 // This function will return true if "m" is in the initialized mutex set
94 // This will create a scoped mutex locking object that doesn't have
95 // a mutex to lock. One will need to be provided using the Reset()
98 Mutex::Locker::Locker () :
104 // Constructor with a Mutex object.
106 // This will create a scoped mutex locking object that extracts the
107 // mutex owned by "m" and locks it.
109 Mutex::Locker::Locker (Mutex& m) :
116 // Constructor with a Mutex object pointer.
118 // This will create a scoped mutex locking object that extracts the
119 // mutex owned by "m" and locks it.
121 Mutex::Locker::Locker (Mutex* m) :
131 // Unlocks any owned mutex object (if it is valid).
133 Mutex::Locker::~Locker ()
139 // Unlock the current mutex in this object (if this owns a valid
140 // mutex) and lock the new "mutex" object if it is non-NULL.
143 Mutex::Locker::Lock (Mutex &mutex)
145 // We already have this mutex locked or both are NULL...
146 if (m_mutex_ptr == &mutex)
151 m_mutex_ptr = &mutex;
156 Mutex::Locker::Unlock ()
166 Mutex::Locker::TryLock (Mutex &mutex, const char *failure_message)
168 // We already have this mutex locked!
169 if (m_mutex_ptr == &mutex)
174 if (mutex.TryLock(failure_message) == 0)
175 m_mutex_ptr = &mutex;
183 // Creates a pthread mutex with no attributes.
185 Mutex::Mutex () :
200 // Creates a pthread mutex with "type" as the mutex type.
202 Mutex::Mutex (Mutex::Type type) :
237 // Destroys the mutex owned by this object.
239 Mutex::~Mutex()
256 // Mutex get accessor.
259 Mutex::GetMutex()
265 // Locks the mutex owned by this object, if the mutex is already
266 // locked, the calling thread will block until the mutex becomes
273 Mutex::Lock()
296 // Attempts to lock the mutex owned by this object without blocking.
297 // If the mutex is already locked, TryLock() will not block waiting
298 // for the mutex, but will return an error condition.
304 Mutex::TryLock(const char *failure_message)
316 // If the current thread holds the lock on the owned mutex, then
317 // Unlock() will unlock the mutex. Calling Unlock() on this object
325 Mutex::Unlock()
354 return Mutex::Unlock();
360 printf("locking mutex %p by [%4.4" PRIx64 "/%4.4" PRIx64 "]...", this, Host::GetCurrentProcessID(), Host::GetCurrentThreadID());
361 int x = Mutex::Lock();
370 printf("unlocking mutex %p by [%4.4" PRIx64 "/%4.4" PRIx64 "]...", this, Host::GetCurrentProcessID(), Host::GetCurrentThreadID());
371 int x = Mutex::Unlock();
380 printf("trylocking mutex %p by [%4.4" PRIx64 "/%4.4" PRIx64 "]...", this, Host::GetCurrentProcessID(), Host::GetCurrentThreadID());
381 int x = Mutex::TryLock(failure_message);