FRIBParallelanalysis  1.0
FrameworkforMPIParalleldataanalysisatFRIB
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
CMutexAttr Struct Reference

#include <CTCLMutex.h>

Public Member Functions

 CMutexAttr ()
 
 ~CMutexAttr ()
 
void setShared ()
 
void setUnshared ()
 
bool isShareable ()
 
void setType (int type)
 
int getType ()
 

Static Public Member Functions

static void throwifbad (int status, const char *message)
 

Public Attributes

pthread_mutexattr_t m_attributes
 

Detailed Description

Direct encapsulation of a pthread mutex attribute block. We only support the attributes in the base pthreads specification (not the realtime nor the advanced realtime specs), as you should be able to count on those always being available

Constructor & Destructor Documentation

◆ CMutexAttr()

CMutexAttr::CMutexAttr ( )

Construct a CMutexAttr&. The member is just initialized and CErrnoException thrown if there was an error:

◆ ~CMutexAttr()

CMutexAttr::~CMutexAttr ( )

Destruction just destroys the attribute block, reporting a CErrnoException if there's an error:

Member Function Documentation

◆ getType()

int CMutexAttr::getType ( )
Returns
int
Return values
oneof the mutex type codes above.

◆ isShareable()

bool CMutexAttr::isShareable ( )

Get the state of the shared flag

Returns
bool
Return values
true- mutex can be used to synchronize processes.
false- Mutex can only be used within the process.

◆ setShared()

void CMutexAttr::setShared ( )

Set the attributes block for a sharable resource. Shared mutexes can be created in shared memory and used for inter-process synchronization.

◆ setType()

void CMutexAttr::setType ( int  type)

Sets the mutex type:

Parameters
type- an integer code that can be one of:
  • PTHREAD_MUTEX_NORMAL - mutex does not detect deadlock
  • PTHREAD_MUTEX_ERRORCHECK - recursively locking a mutex is an error.
  • PTHREAD_MUTEX_RECURSIVE - Recursive mutex locking is supported with a lock depth count.
  • PTHREAD_MUTEX_DEFAULT - Same meaning as PTHEAD_MUTEX_NORMAL in linux anyway, I won't gaurentee this is the same value though.

◆ setUnshared()

void CMutexAttr::setUnshared ( )

Set the mutex attributes to process private. The mutex can only synchronize threads in the creating process.


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