• Home
  • Raw
  • Download

Lines Matching refs:Mutex

135 class Mutex {
141 inline Mutex();
144 inline ~Mutex();
170 Mutex(Mutex* /*ignored*/) {} in Mutex() function
172 Mutex(const Mutex&);
173 void operator=(const Mutex&);
190 Mutex::Mutex() : mutex_(0) { } in Mutex() function
191 Mutex::~Mutex() { assert(mutex_ == 0); } in ~Mutex()
192 void Mutex::Lock() { assert(--mutex_ == -1); } in Lock()
193 void Mutex::Unlock() { assert(mutex_++ == -1); } in Unlock()
195 bool Mutex::TryLock() { if (mutex_) return false; Lock(); return true; } in TryLock()
197 void Mutex::ReaderLock() { assert(++mutex_ > 0); } in ReaderLock()
198 void Mutex::ReaderUnlock() { assert(mutex_-- > 0); } in ReaderUnlock()
202 Mutex::Mutex() { InitializeCriticalSection(&mutex_); SetIsSafe(); } in Mutex() function
203 Mutex::~Mutex() { DeleteCriticalSection(&mutex_); } in ~Mutex()
204 void Mutex::Lock() { if (is_safe_) EnterCriticalSection(&mutex_); } in Lock()
205 void Mutex::Unlock() { if (is_safe_) LeaveCriticalSection(&mutex_); } in Unlock()
207 bool Mutex::TryLock() { return is_safe_ ? in TryLock()
210 void Mutex::ReaderLock() { Lock(); } // we don't have read-write locks in ReaderLock()
211 void Mutex::ReaderUnlock() { Unlock(); } in ReaderUnlock()
220 Mutex::Mutex() { in Mutex() function
224 Mutex::~Mutex() { SAFE_PTHREAD(pthread_rwlock_destroy); } in ~Mutex()
225 void Mutex::Lock() { SAFE_PTHREAD(pthread_rwlock_wrlock); } in Lock()
226 void Mutex::Unlock() { SAFE_PTHREAD(pthread_rwlock_unlock); } in Unlock()
228 bool Mutex::TryLock() { return is_safe_ ? in TryLock()
232 void Mutex::ReaderLock() { SAFE_PTHREAD(pthread_rwlock_rdlock); } in ReaderLock()
233 void Mutex::ReaderUnlock() { SAFE_PTHREAD(pthread_rwlock_unlock); } in ReaderUnlock()
243 Mutex::Mutex() { in Mutex() function
247 Mutex::~Mutex() { SAFE_PTHREAD(pthread_mutex_destroy); } in ~Mutex()
248 void Mutex::Lock() { SAFE_PTHREAD(pthread_mutex_lock); } in Lock()
249 void Mutex::Unlock() { SAFE_PTHREAD(pthread_mutex_unlock); } in Unlock()
251 bool Mutex::TryLock() { return is_safe_ ? in TryLock()
254 void Mutex::ReaderLock() { Lock(); } in ReaderLock()
255 void Mutex::ReaderUnlock() { Unlock(); } in ReaderUnlock()
266 explicit MutexLock(Mutex *mu) : mu_(mu) { mu_->Lock(); } in MutexLock()
269 Mutex * const mu_;
278 explicit ReaderMutexLock(Mutex *mu) : mu_(mu) { mu_->ReaderLock(); } in ReaderMutexLock()
281 Mutex * const mu_;
289 explicit WriterMutexLock(Mutex *mu) : mu_(mu) { mu_->WriterLock(); } in WriterMutexLock()
292 Mutex * const mu_;