Lines Matching refs:mutex_
176 MutexType mutex_;
197 // but only one writer. We represent this by having mutex_ be -1 when
204 Mutex::Mutex() : mutex_(0) { }
205 Mutex::~Mutex() { assert(mutex_ == 0); }
206 void Mutex::Lock() { assert(--mutex_ == -1); }
207 void Mutex::Unlock() { assert(mutex_++ == -1); }
209 bool Mutex::TryLock() { if (mutex_) return false; Lock(); return true; }
211 void Mutex::ReaderLock() { assert(++mutex_ > 0); }
212 void Mutex::ReaderUnlock() { assert(mutex_-- > 0); }
216 Mutex::Mutex() { InitializeCriticalSection(&mutex_); SetIsSafe(); }
217 Mutex::~Mutex() { DeleteCriticalSection(&mutex_); }
218 void Mutex::Lock() { if (is_safe_) EnterCriticalSection(&mutex_); }
219 void Mutex::Unlock() { if (is_safe_) LeaveCriticalSection(&mutex_); }
222 TryEnterCriticalSection(&mutex_) != 0 : true; }
230 if (is_safe_ && fncall(&mutex_) != 0) abort(); \
235 if (is_safe_ && pthread_rwlock_init(&mutex_, NULL) != 0) abort();
242 pthread_rwlock_trywrlock(&mutex_) == 0 :
252 if (is_safe_ && fncall(&mutex_) != 0) abort(); \
257 if (is_safe_ && pthread_mutex_init(&mutex_, NULL) != 0) abort();
264 pthread_mutex_trylock(&mutex_) == 0 : true; }