Lines Matching refs:mutex_
161 MutexType mutex_;
182 // but only one writer. We represent this by having mutex_ be -1 when
190 Mutex::Mutex() : mutex_(0) { }
191 Mutex::~Mutex() { assert(mutex_ == 0); }
192 void Mutex::Lock() { assert(--mutex_ == -1); }
193 void Mutex::Unlock() { assert(mutex_++ == -1); }
195 bool Mutex::TryLock() { if (mutex_) return false; Lock(); return true; }
197 void Mutex::ReaderLock() { assert(++mutex_ > 0); }
198 void Mutex::ReaderUnlock() { assert(mutex_-- > 0); }
202 Mutex::Mutex() { InitializeCriticalSection(&mutex_); SetIsSafe(); }
203 Mutex::~Mutex() { DeleteCriticalSection(&mutex_); }
204 void Mutex::Lock() { if (is_safe_) EnterCriticalSection(&mutex_); }
205 void Mutex::Unlock() { if (is_safe_) LeaveCriticalSection(&mutex_); }
208 TryEnterCriticalSection(&mutex_) != 0 : true; }
217 if (is_safe_ && fncall(&mutex_) != 0) abort(); \
222 if (is_safe_ && pthread_rwlock_init(&mutex_, NULL) != 0) abort();
229 pthread_rwlock_trywrlock(&mutex_) == 0 :
240 if (is_safe_ && fncall(&mutex_) != 0) abort(); \
245 if (is_safe_ && pthread_mutex_init(&mutex_, NULL) != 0) abort();
252 pthread_mutex_trylock(&mutex_) == 0 : true; }