#ifndef _MTX_LOCK_ #define _MTX_LOCK_ #include class MtxLock { pthread_mutex_t& m_; public: inline MtxLock( pthread_mutex_t& m) : m_( m ) { pthread_mutex_lock( &m_ ); } inline ~MtxLock() { pthread_mutex_unlock( &m_ ); } inline int Lock() { return pthread_mutex_lock( &m_ ); } inline int Unlock() { return pthread_mutex_unlock( &m_ ); } }; #endif