Lines Matching full:mutex
204 * Simple mutex class. The implementation is system-dependent.
206 * The mutex must be unlocked by the thread that locked it. They are not
209 class Mutex {
216 Mutex();
217 Mutex(const char* name);
218 Mutex(int type, const char* name = NULL);
219 ~Mutex();
221 // lock or unlock the mutex
228 // Manages the mutex automatically. It'll be locked when Autolock is
232 inline Autolock(Mutex& mutex) : mLock(mutex) { mLock.lock(); }
233 inline Autolock(Mutex* mutex) : mLock(*mutex) { mLock.lock(); }
236 Mutex& mLock;
242 // A mutex cannot be copied
243 Mutex(const Mutex&);
244 Mutex& operator = (const Mutex&);
256 inline Mutex::Mutex() {
259 inline Mutex::Mutex(const char* name) {
262 inline Mutex::Mutex(int type, const char* name) {
273 inline Mutex::~Mutex() {
276 inline status_t Mutex::lock() {
279 inline void Mutex::unlock() {
282 inline status_t Mutex::tryLock() {
289 * Automatic mutex. Declare one of these at the top of a function.
291 * mutex.
294 typedef Mutex::Autolock AutoMutex;
301 * Condition variables are paired up with mutexes. Lock the mutex,
303 * or unlock the mutex and continue. All threads calling wait() must
304 * use the same mutex for a given Condition.
316 // Wait on the condition variable. Lock the mutex before calling.
317 status_t wait(Mutex& mutex);
319 status_t waitRelative(Mutex& mutex, nsecs_t reltime);
352 inline status_t Condition::wait(Mutex& mutex) {
353 return -pthread_cond_wait(&mCond, &mutex.mMutex);
355 inline status_t Condition::waitRelative(Mutex& mutex, nsecs_t reltime) {
360 return -pthread_cond_timedwait_relative_np(&mCond, &mutex.mMutex, &ts);
378 return -pthread_cond_timedwait(&mCond, &mutex.mMutex, &ts);
440 Mutex mLock;