// PThreadMutexLocker.cxx #include "dataset_util/PThreadMutexLocker.h" #include //********************************************************************** // Methods. //********************************************************************** // Constructor from reference. PThreadMutexLocker::PThreadMutexLocker(PThreadMutex& mtx) : m_pmtx(&mtx) { if ( mtx.is_valid() ) { int lstat = mtx.lock(); assert( lstat == 0 ); } } //********************************************************************** // Constructor from pointer. PThreadMutexLocker::PThreadMutexLocker(PThreadMutex* pmtx) : m_pmtx(pmtx) { if ( pmtx!=0 && pmtx->is_valid() ) { int lstat = pmtx->lock(); assert( lstat == 0 ); } } //********************************************************************** // Destructor. PThreadMutexLocker::~PThreadMutexLocker() { if ( m_pmtx!=0 && m_pmtx->is_valid() ) { int ustat = m_pmtx->unlock(); assert( ustat == 0 ); } } //**********************************************************************