Lines Matching refs:Mutex
50 class Mutex {
53 inline Mutex();
56 inline ~Mutex();
75 Mutex(Mutex *ignored);
77 Mutex(const Mutex&);
78 void operator=(const Mutex&);
95 Mutex::Mutex() : mutex_(0) { } in Mutex() function
96 Mutex::~Mutex() { assert(mutex_ == 0); } in ~Mutex()
97 void Mutex::Lock() { assert(--mutex_ == -1); } in Lock()
98 void Mutex::Unlock() { assert(mutex_++ == -1); } in Unlock()
99 bool Mutex::TryLock() { if (mutex_) return false; Lock(); return true; } in TryLock()
100 void Mutex::ReaderLock() { assert(++mutex_ > 0); } in ReaderLock()
101 void Mutex::ReaderUnlock() { assert(mutex_-- > 0); } in ReaderUnlock()
108 Mutex::Mutex() { SAFE_PTHREAD(pthread_rwlock_init(&mutex_, NULL)); } in Mutex() function
109 Mutex::~Mutex() { SAFE_PTHREAD(pthread_rwlock_destroy(&mutex_)); } in ~Mutex()
110 void Mutex::Lock() { SAFE_PTHREAD(pthread_rwlock_wrlock(&mutex_)); } in Lock()
111 void Mutex::Unlock() { SAFE_PTHREAD(pthread_rwlock_unlock(&mutex_)); } in Unlock()
112 bool Mutex::TryLock() { return pthread_rwlock_trywrlock(&mutex_) == 0; } in TryLock()
113 void Mutex::ReaderLock() { SAFE_PTHREAD(pthread_rwlock_rdlock(&mutex_)); } in ReaderLock()
114 void Mutex::ReaderUnlock() { SAFE_PTHREAD(pthread_rwlock_unlock(&mutex_)); } in ReaderUnlock()
123 Mutex::Mutex() { SAFE_PTHREAD(pthread_mutex_init(&mutex_, NULL)); } in Mutex() function
124 Mutex::~Mutex() { SAFE_PTHREAD(pthread_mutex_destroy(&mutex_)); } in ~Mutex()
125 void Mutex::Lock() { SAFE_PTHREAD(pthread_mutex_lock(&mutex_)); } in Lock()
126 void Mutex::Unlock() { SAFE_PTHREAD(pthread_mutex_unlock(&mutex_)); } in Unlock()
127 bool Mutex::TryLock() { return pthread_mutex_trylock(&mutex_) == 0; } in TryLock()
128 void Mutex::ReaderLock() { Lock(); } // we don't have read-write locks in ReaderLock()
129 void Mutex::ReaderUnlock() { Unlock(); } in ReaderUnlock()
134 Mutex::Mutex() { InitializeCriticalSection(&mutex_); } in Mutex() function
135 Mutex::~Mutex() { DeleteCriticalSection(&mutex_); } in ~Mutex()
136 void Mutex::Lock() { EnterCriticalSection(&mutex_); } in Lock()
137 void Mutex::Unlock() { LeaveCriticalSection(&mutex_); } in Unlock()
138 bool Mutex::TryLock() { return TryEnterCriticalSection(&mutex_) != 0; } in TryLock()
139 void Mutex::ReaderLock() { Lock(); } // we don't have read-write locks in ReaderLock()
140 void Mutex::ReaderUnlock() { Unlock(); } in ReaderUnlock()
151 explicit MutexLock(Mutex *mu) : mu_(mu) { mu_->Lock(); } in MutexLock()
154 Mutex * const mu_;
163 explicit ReaderMutexLock(Mutex *mu) : mu_(mu) { mu_->ReaderLock(); } in ReaderMutexLock()
166 Mutex * const mu_;
174 explicit WriterMutexLock(Mutex *mu) : mu_(mu) { mu_->WriterLock(); } in WriterMutexLock()
177 Mutex * const mu_;
201 static Mutex name