1 ////////////////////////////////////////
5 // 1. Declair the CMutex class that encapsulates the functionality of a
6 // mutually-exclusive device.
12 #ifndef BASE_SOLARIS_MUTEX_H
13 #define BASE_SOLARIS_MUTEX_H
15 #if !defined(_REENTRANT)
16 # pragma message( "Excluding Base::CMutex - requires multi-threaded compile. (_REENTRANT)" )
25 ////////////////////////////////////////
30 // Encapsulates the functionality of a mutually-exclusive device.
31 // This class is valuable for protecting against race conditions
32 // within threaded applications. The CMutex class can be used to
33 // only allow a single thread to run within a specified code
37 // Lock() : Locks the mutex. If the mutex is already locked, the
38 // operating system will block the calling thread until another
39 // thread has unlocked the mutex.
40 // Unlock() : Unlocks the mutex.
51 pthread_mutex_t mMutex
;
55 inline void CMutex::Lock(void)
58 pthread_mutex_lock(&mMutex
);
61 inline void CMutex::Unlock(void)
64 pthread_mutex_unlock(&mMutex
);
69 #endif // #if defined(_MT)
71 #endif // BASE_SOLARIS_MUTEX_H