nidas  v1.2-1520
Public Member Functions | Private Member Functions | Private Attributes | List of all members
nidas::util::RWLock Class Reference

A C++ wrapper for a POSIX rwlock. More...

#include <ThreadSupport.h>

Public Member Functions

 RWLock () throw ()
 Construct a POSIX rwlock. More...
 
 RWLock (const RWLockAttributes &attr) throw (Exception)
 
 RWLock (const RWLock &x) throw ()
 Copy constructor. More...
 
 ~RWLock ()
 Destruct a RWLock. More...
 
void rdlock () throw (Exception)
 Acquire a read lock. More...
 
void wrlock () throw (Exception)
 Acquire a write lock. More...
 
void unlock () throw (Exception)
 Unlock the RWLock. More...
 
pthread_rwlock_t * ptr ()
 Get the pointer to the pthread_rwlock_t. More...
 

Private Member Functions

RWLockoperator= (const RWLock &)
 No assignment allowed. More...
 

Private Attributes

pthread_rwlock_t _p_rwlock
 
RWLockAttributes _attrs
 

Detailed Description

A C++ wrapper for a POSIX rwlock.

Constructor & Destructor Documentation

RWLock::RWLock ( )
throw (
)

Construct a POSIX rwlock.

See man page for pthread_rwlock_init.

RWLock::RWLock ( const RWLockAttributes attr)
throw (Exception
)
RWLock::RWLock ( const RWLock x)
throw (
)

Copy constructor.

Creates a new, unlocked rwlock.

RWLock::~RWLock ( )

Destruct a RWLock.

See man page for pthread_rwlock_destroy. RwLock must not be locked, otherwise std::terminate() is called.

References _p_rwlock, CLOG, and nidas::util::Exception::what().

Member Function Documentation

RWLock& nidas::util::RWLock::operator= ( const RWLock )
private

No assignment allowed.

pthread_rwlock_t * RWLock::ptr ( )

Get the pointer to the pthread_rwlock_t.

References _p_rwlock.

void nidas::util::RWLock::rdlock ( )
throw (Exception
)
inline

Acquire a read lock.

May throw an exception if the maximum number of read locks for this RWLock has been exceeded.

Referenced by nidas::dynld::UDPSampleOutput::getProjectDOM().

void nidas::util::RWLock::unlock ( )
throw (Exception
)
inline

Unlock the RWLock.

Will throw an exception EPERM if the current thread does not hold a lock.

Referenced by nidas::dynld::UDPSampleOutput::releaseProjectDOM().

void nidas::util::RWLock::wrlock ( )
throw (Exception
)
inline

Acquire a write lock.

May throw an exception if the current thread already owns the lock.

Member Data Documentation

RWLockAttributes nidas::util::RWLock::_attrs
private
pthread_rwlock_t nidas::util::RWLock::_p_rwlock
private

Referenced by ptr(), and ~RWLock().


The documentation for this class was generated from the following files: