/***************************************************** ** Mutex.h ** ** ------- ** ** ** ** A simple mutual exclusion lock for use in apps ** ** running on multiple threads that wish to ** ** synchronize access to data or critical code ** ** sections. Calling Acquire() stalls the thread ** ** until the lock is free, Release() notifies ** ** others that you are done, allowing another ** ** thread access. ** ** ** ** Note: This builds on pthreads!! ** ** ** ** Chris Wyman (2/12/2007) ** *****************************************************/ #ifndef SIMPLEMUTEX_H #define SIMPLEMUTEX_H #include class Mutex { private: pthread_mutex_t mutex; public: Mutex(); ~Mutex(); // Stall until the mutex is acquired void Acquire( void ); // Release a previously acquired mutex void Release( void ); }; #endif