Lines Matching refs:mutex_

72   MutexType mutex_;
87 // but only one writer. We represent this by having mutex_ be -1 when
95 Mutex::Mutex() : mutex_(0) { }
96 Mutex::~Mutex() { assert(mutex_ == 0); }
97 void Mutex::Lock() { assert(--mutex_ == -1); }
98 void Mutex::Unlock() { assert(mutex_++ == -1); }
99 bool Mutex::TryLock() { if (mutex_) return false; Lock(); return true; }
100 void Mutex::ReaderLock() { assert(++mutex_ > 0); }
101 void Mutex::ReaderUnlock() { assert(mutex_-- > 0); }
108 Mutex::Mutex() { SAFE_PTHREAD(pthread_rwlock_init(&mutex_, NULL)); }
109 Mutex::~Mutex() { SAFE_PTHREAD(pthread_rwlock_destroy(&mutex_)); }
110 void Mutex::Lock() { SAFE_PTHREAD(pthread_rwlock_wrlock(&mutex_)); }
111 void Mutex::Unlock() { SAFE_PTHREAD(pthread_rwlock_unlock(&mutex_)); }
112 bool Mutex::TryLock() { return pthread_rwlock_trywrlock(&mutex_) == 0; }
113 void Mutex::ReaderLock() { SAFE_PTHREAD(pthread_rwlock_rdlock(&mutex_)); }
114 void Mutex::ReaderUnlock() { SAFE_PTHREAD(pthread_rwlock_unlock(&mutex_)); }
123 Mutex::Mutex() { SAFE_PTHREAD(pthread_mutex_init(&mutex_, NULL)); }
124 Mutex::~Mutex() { SAFE_PTHREAD(pthread_mutex_destroy(&mutex_)); }
125 void Mutex::Lock() { SAFE_PTHREAD(pthread_mutex_lock(&mutex_)); }
126 void Mutex::Unlock() { SAFE_PTHREAD(pthread_mutex_unlock(&mutex_)); }
127 bool Mutex::TryLock() { return pthread_mutex_trylock(&mutex_) == 0; }
134 Mutex::Mutex() { InitializeCriticalSection(&mutex_); }
135 Mutex::~Mutex() { DeleteCriticalSection(&mutex_); }
136 void Mutex::Lock() { EnterCriticalSection(&mutex_); }
137 void Mutex::Unlock() { LeaveCriticalSection(&mutex_); }
138 bool Mutex::TryLock() { return TryEnterCriticalSection(&mutex_) != 0; }