/* * SyncC++ * * Copyright(c) Haifeng Li 2002 * All Rights Reserved * */ #ifndef __HLI_MUTEX_H #define __HLI_MUTEX_H #include class mutex { public: mutex::mutex() { pthread_mutex_init(&_mutex, NULL); } mutex::~mutex() { pthread_mutex_destroy(&_mutex); } void mutex::lock(void) { pthread_mutex_lock(&_mutex); } void mutex::unlock(void) { pthread_mutex_unlock(&_mutex); } private: // prevent copying mutex(const mutex&); mutex& operator = (const mutex&); pthread_mutex_t _mutex; }; #endif // __HLI_MUTEX_H