Lines Matching refs:mutex_

76   MutexType mutex_;
91 // but only one writer. We represent this by having mutex_ be -1 when
99 Mutex::Mutex() : mutex_(0) { }
100 Mutex::~Mutex() { assert(mutex_ == 0); }
101 void Mutex::Lock() { assert(--mutex_ == -1); }
102 void Mutex::Unlock() { assert(mutex_++ == -1); }
103 bool Mutex::TryLock() { if (mutex_) return false; Lock(); return true; }
104 void Mutex::ReaderLock() { assert(++mutex_ > 0); }
105 void Mutex::ReaderUnlock() { assert(mutex_-- > 0); }
112 Mutex::Mutex() { SAFE_PTHREAD(pthread_rwlock_init(&mutex_, NULL)); }
113 Mutex::~Mutex() { SAFE_PTHREAD(pthread_rwlock_destroy(&mutex_)); }
114 void Mutex::Lock() { SAFE_PTHREAD(pthread_rwlock_wrlock(&mutex_)); }
115 void Mutex::Unlock() { SAFE_PTHREAD(pthread_rwlock_unlock(&mutex_)); }
116 bool Mutex::TryLock() { return pthread_rwlock_trywrlock(&mutex_) == 0; }
117 void Mutex::ReaderLock() { SAFE_PTHREAD(pthread_rwlock_rdlock(&mutex_)); }
118 void Mutex::ReaderUnlock() { SAFE_PTHREAD(pthread_rwlock_unlock(&mutex_)); }
127 Mutex::Mutex() { SAFE_PTHREAD(pthread_mutex_init(&mutex_, NULL)); }
128 Mutex::~Mutex() { SAFE_PTHREAD(pthread_mutex_destroy(&mutex_)); }
129 void Mutex::Lock() { SAFE_PTHREAD(pthread_mutex_lock(&mutex_)); }
130 void Mutex::Unlock() { SAFE_PTHREAD(pthread_mutex_unlock(&mutex_)); }
131 bool Mutex::TryLock() { return pthread_mutex_trylock(&mutex_) == 0; }
138 Mutex::Mutex() { InitializeCriticalSection(&mutex_); }
139 Mutex::~Mutex() { DeleteCriticalSection(&mutex_); }
140 void Mutex::Lock() { EnterCriticalSection(&mutex_); }
141 void Mutex::Unlock() { LeaveCriticalSection(&mutex_); }
142 bool Mutex::TryLock() { return TryEnterCriticalSection(&mutex_) != 0; }