Lines Matching refs:Mutex
157 class Mutex {
164 inline Mutex();
169 explicit inline Mutex(LinkerInitialized);
172 inline ~Mutex();
200 explicit Mutex(Mutex* /*ignored*/) {} in Mutex() function
202 Mutex(const Mutex&);
203 void operator=(const Mutex&);
219 Mutex::Mutex() : mutex_(0) { } in Mutex() function
220 Mutex::Mutex(Mutex::LinkerInitialized) : mutex_(0) { } in Mutex() function
221 Mutex::~Mutex() { assert(mutex_ == 0); } in ~Mutex()
222 void Mutex::Lock() { assert(--mutex_ == -1); } in Lock()
223 void Mutex::Unlock() { assert(mutex_++ == -1); } in Unlock()
225 bool Mutex::TryLock() { if (mutex_) return false; Lock(); return true; } in TryLock()
227 void Mutex::ReaderLock() { assert(++mutex_ > 0); } in ReaderLock()
228 void Mutex::ReaderUnlock() { assert(mutex_-- > 0); } in ReaderUnlock()
232 Mutex::Mutex() : destroy_(true) { in Mutex() function
236 Mutex::Mutex(LinkerInitialized) : destroy_(false) { in Mutex() function
240 Mutex::~Mutex() { if (destroy_) DeleteCriticalSection(&mutex_); } in ~Mutex()
241 void Mutex::Lock() { if (is_safe_) EnterCriticalSection(&mutex_); } in Lock()
242 void Mutex::Unlock() { if (is_safe_) LeaveCriticalSection(&mutex_); } in Unlock()
244 bool Mutex::TryLock() { return is_safe_ ? in TryLock()
247 void Mutex::ReaderLock() { Lock(); } // we don't have read-write locks in ReaderLock()
248 void Mutex::ReaderUnlock() { Unlock(); } in ReaderUnlock()
256 Mutex::Mutex() : destroy_(true) { in Mutex() function
260 Mutex::Mutex(Mutex::LinkerInitialized) : destroy_(false) { in Mutex() function
264 Mutex::~Mutex() { if (destroy_) SAFE_PTHREAD(pthread_rwlock_destroy); } in ~Mutex()
265 void Mutex::Lock() { SAFE_PTHREAD(pthread_rwlock_wrlock); } in Lock()
266 void Mutex::Unlock() { SAFE_PTHREAD(pthread_rwlock_unlock); } in Unlock()
268 bool Mutex::TryLock() { return is_safe_ ? in TryLock()
271 void Mutex::ReaderLock() { SAFE_PTHREAD(pthread_rwlock_rdlock); } in ReaderLock()
272 void Mutex::ReaderUnlock() { SAFE_PTHREAD(pthread_rwlock_unlock); } in ReaderUnlock()
281 Mutex::Mutex() : destroy_(true) { in Mutex() function
285 Mutex::Mutex(Mutex::LinkerInitialized) : destroy_(false) { in Mutex() function
289 Mutex::~Mutex() { if (destroy_) SAFE_PTHREAD(pthread_mutex_destroy); } in ~Mutex()
290 void Mutex::Lock() { SAFE_PTHREAD(pthread_mutex_lock); } in Lock()
291 void Mutex::Unlock() { SAFE_PTHREAD(pthread_mutex_unlock); } in Unlock()
293 bool Mutex::TryLock() { return is_safe_ ? in TryLock()
296 void Mutex::ReaderLock() { Lock(); } in ReaderLock()
297 void Mutex::ReaderUnlock() { Unlock(); } in ReaderUnlock()
308 explicit MutexLock(Mutex *mu) : mu_(mu) { mu_->Lock(); } in MutexLock()
311 Mutex * const mu_;
320 explicit ReaderMutexLock(Mutex *mu) : mu_(mu) { mu_->ReaderLock(); } in ReaderMutexLock()
323 Mutex * const mu_;
331 explicit WriterMutexLock(Mutex *mu) : mu_(mu) { mu_->WriterLock(); } in WriterMutexLock()
334 Mutex * const mu_;