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

A C++ wrapper for a POSIX mutex attributes. More...

#include <ThreadSupport.h>

Public Member Functions

 MutexAttributes ()
 Create instance with default values, type = PTHREAD_MUTEX_DEFAULT, priority protocol=PTHREAD_PRIO_NONE and pshared = PTHREAD_PROCESS_PRIVATE. More...
 
 MutexAttributes (const MutexAttributes &)
 Copy constructor. More...
 
 ~MutexAttributes ()
 
void setType (int val) throw (Exception)
 Set the mutex type attribute, one of PTHREAD_MUTEX_NORMAL,PTHREAD_MUTEX_ERRORCHECK,PTHREAD_MUTEX_RECURSIVE, or PTHREAD_MUTEX_DEFAULT. More...
 
int getType () const
 
void setPShared (int val) throw (Exception)
 Set the mutex pshared attribute, one of PTHREAD_PROCESS_PRIVATE or PTHREAD_PROCESS_SHARED. More...
 
int getPShared () const
 
pthread_mutexattr_t * ptr ()
 

Private Attributes

pthread_mutexattr_t _attrs
 

Detailed Description

A C++ wrapper for a POSIX mutex attributes.

These are customizations for Mutexes, and are only needed if you want more than the default error checking, if you want recursive behaviour where a thread can hold more than lock on the same mutex, if you are using fine-grained thread scheduling priority, or want to share a Mutex between processes.

See man pages for pthread_mutexattr_init, pthread_mutexattr_settype, pthread_mutexattr_setprioceiling, pthread_mutexattr_setprotocol, and pthread_mutexattr_setpshared.

Constructor & Destructor Documentation

MutexAttributes::MutexAttributes ( )

Create instance with default values, type = PTHREAD_MUTEX_DEFAULT, priority protocol=PTHREAD_PRIO_NONE and pshared = PTHREAD_PROCESS_PRIVATE.

References _attrs.

MutexAttributes::MutexAttributes ( const MutexAttributes x)

Copy constructor.

References _attrs, getPShared(), getType(), setPShared(), and setType().

MutexAttributes::~MutexAttributes ( )

References _attrs.

Member Function Documentation

int MutexAttributes::getPShared ( ) const

References _attrs.

Referenced by MutexAttributes().

int MutexAttributes::getType ( ) const

References _attrs.

Referenced by MutexAttributes().

pthread_mutexattr_t* nidas::util::MutexAttributes::ptr ( )
inline

References _attrs.

void MutexAttributes::setPShared ( int  val)
throw (Exception
)

Set the mutex pshared attribute, one of PTHREAD_PROCESS_PRIVATE or PTHREAD_PROCESS_SHARED.

See pthread_mutexattr_setpshared.

Referenced by MutexAttributes().

void MutexAttributes::setType ( int  val)
throw (Exception
)

Set the mutex type attribute, one of PTHREAD_MUTEX_NORMAL,PTHREAD_MUTEX_ERRORCHECK,PTHREAD_MUTEX_RECURSIVE, or PTHREAD_MUTEX_DEFAULT.

See pthread_mutexattr_settype.

Referenced by MutexAttributes().

Member Data Documentation

pthread_mutexattr_t nidas::util::MutexAttributes::_attrs
private

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