nidas v1.2.3
|
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. | |
MutexAttributes (const MutexAttributes &) | |
Copy constructor. | |
~MutexAttributes () | |
void | setType (int val) |
Set the mutex type attribute, one of PTHREAD_MUTEX_NORMAL,PTHREAD_MUTEX_ERRORCHECK,PTHREAD_MUTEX_RECURSIVE, or PTHREAD_MUTEX_DEFAULT. | |
int | getType () const |
void | setPShared (int val) |
Set the mutex pshared attribute, one of PTHREAD_PROCESS_PRIVATE or PTHREAD_PROCESS_SHARED. | |
int | getPShared () const |
pthread_mutexattr_t * | ptr () |
Private Attributes | |
pthread_mutexattr_t | _attrs |
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.
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, setPShared(), and setType().
MutexAttributes::~MutexAttributes | ( | ) |
References _attrs.
int MutexAttributes::getPShared | ( | ) | const |
References _attrs.
int MutexAttributes::getType | ( | ) | const |
References _attrs.
|
inline |
References _attrs.
Referenced by nidas::util::Mutex::Mutex().
void MutexAttributes::setPShared | ( | int | val | ) |
Set the mutex pshared attribute, one of PTHREAD_PROCESS_PRIVATE or PTHREAD_PROCESS_SHARED.
See pthread_mutexattr_setpshared.
Exception |
References _attrs.
Referenced by MutexAttributes().
void MutexAttributes::setType | ( | int | val | ) |
Set the mutex type attribute, one of PTHREAD_MUTEX_NORMAL,PTHREAD_MUTEX_ERRORCHECK,PTHREAD_MUTEX_RECURSIVE, or PTHREAD_MUTEX_DEFAULT.
See pthread_mutexattr_settype.
Exception |
References _attrs.
Referenced by MutexAttributes().
|
private |
Referenced by getPShared(), getType(), MutexAttributes(), MutexAttributes(), ptr(), setPShared(), setType(), and ~MutexAttributes().