00001 00002 #ifndef __mutex_hpp__ 00003 #define __mutex_hpp__ 00004 00005 #include <pthread.h> 00006 00007 class Mutex 00008 { 00009 public: 00010 Mutex() { pthread_mutex_init( &_mutex, NULL ); } 00011 ~Mutex() { pthread_mutex_destroy( &_mutex ); } 00012 00013 void lock() { pthread_mutex_lock( &_mutex ); } 00014 void unlock() { pthread_mutex_unlock( &_mutex ); } 00015 00016 private: 00017 pthread_mutex_t _mutex; 00018 }; 00019 00020 #endif // __mutex_hpp__