CPN
Computational Process Networks
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
PthreadAttr Class Reference

#include <PthreadAttr.h>

+ Inheritance diagram for PthreadAttr:
+ Collaboration diagram for PthreadAttr:

Public Member Functions

 PthreadAttr (int systemScope=0)
 
 ~PthreadAttr (void)
 
 PthreadAttr (const PthreadAttr &)
 
 operator pthread_attr_t * (void)
 
 operator const pthread_attr_t * (void) const
 
void CreateDetached (void)
 
void CreateJoinable (void)
 
int Detached (void)
 
int Joinable (void)
 
void SystemScope (void)
 
void ProcessScope (void)
 
int InSystemScope (void)
 
int InProcessScope (void)
 
int Error (void)
 
void Clear (void)
 

Protected Member Functions

void TrapError (int result)
 

Protected Attributes

int error
 

Private Member Functions

int DetachState (int detState)
 
int DetachState (void)
 
int ScheduleScope (int scope)
 
int ScheduleScope (void)
 

Private Attributes

pthread_attr_t attr
 
int referenceCount
 

Detailed Description

Definition at line 40 of file PthreadAttr.h.

Constructor & Destructor Documentation

PthreadAttr::PthreadAttr ( int  systemScope = 0)

Definition at line 32 of file PthreadAttr.cc.

References attr, referenceCount, SystemScope(), and PthreadErrorHandler::TrapError().

34 {
35  TrapError(pthread_attr_init(&attr));
36  if (systemScope) SystemScope();
37  referenceCount = 1;
38 // printf("PthreadAttr::PthreadAttr()\n");
39 }
pthread_attr_t attr
Definition: PthreadAttr.h:100
void SystemScope(void)
Definition: PthreadAttr.h:94
void TrapError(int result)
int referenceCount
Definition: PthreadAttr.h:101

+ Here is the call graph for this function:

PthreadAttr::~PthreadAttr ( void  )

Definition at line 42 of file PthreadAttr.cc.

References attr, referenceCount, and PthreadErrorHandler::TrapError().

44 {
45  try {
47  // printf("PthreadAttr::~PthreadAttr: referenceCount = %d\n", referenceCount);
48  if (!referenceCount)
49  TrapError(pthread_attr_destroy(&attr));
50  } catch (...) {
51  std::terminate();
52  }
53 }
pthread_attr_t attr
Definition: PthreadAttr.h:100
void TrapError(int result)
int referenceCount
Definition: PthreadAttr.h:101

+ Here is the call graph for this function:

PthreadAttr::PthreadAttr ( const PthreadAttr cpAttr)

Definition at line 57 of file PthreadAttr.cc.

References attr, and referenceCount.

59 {
60  attr = cpAttr.attr;
61  referenceCount = cpAttr.referenceCount+1;
62 // printf("PthreadAttr::PthreadAttr(const PthreadAttr&): referenceCount = %d\n", referenceCount);
63 }
pthread_attr_t attr
Definition: PthreadAttr.h:100
int referenceCount
Definition: PthreadAttr.h:101

Member Function Documentation

void PthreadErrorHandler::Clear ( void  )
inlineinherited

Definition at line 40 of file PthreadErrorHandler.h.

References PthreadErrorHandler::error.

40 { error = 0; }
void PthreadAttr::CreateDetached ( void  )
inline

Definition at line 51 of file PthreadAttr.h.

References DetachState().

51 { DetachState(PTHREAD_CREATE_DETACHED); }
int DetachState(void)
Definition: PthreadAttr.cc:67

+ Here is the call graph for this function:

void PthreadAttr::CreateJoinable ( void  )
inline

Definition at line 52 of file PthreadAttr.h.

References DetachState().

52 { DetachState(PTHREAD_CREATE_JOINABLE); }
int DetachState(void)
Definition: PthreadAttr.cc:67

+ Here is the call graph for this function:

int PthreadAttr::Detached ( void  )
inline

Definition at line 53 of file PthreadAttr.h.

References DetachState().

53 { return DetachState() == PTHREAD_CREATE_DETACHED; }
int DetachState(void)
Definition: PthreadAttr.cc:67

+ Here is the call graph for this function:

int PthreadAttr::DetachState ( int  detState)
private

Definition at line 83 of file PthreadAttr.cc.

References attr, and PthreadErrorHandler::TrapError().

87 {
88  TrapError(pthread_attr_setdetachstate(&attr, detState));
89  return detState;
90 }
pthread_attr_t attr
Definition: PthreadAttr.h:100
void TrapError(int result)

+ Here is the call graph for this function:

int PthreadAttr::DetachState ( void  )
private

Definition at line 67 of file PthreadAttr.cc.

References attr, and PthreadErrorHandler::TrapError().

Referenced by CreateDetached(), CreateJoinable(), Detached(), and Joinable().

75 {
76  int detState;
77  TrapError(pthread_attr_getdetachstate(&attr, &detState));
78  return detState;
79 }
pthread_attr_t attr
Definition: PthreadAttr.h:100
void TrapError(int result)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int PthreadErrorHandler::Error ( void  )
inlineinherited

Definition at line 39 of file PthreadErrorHandler.h.

References PthreadErrorHandler::error.

39 { return error; }
int PthreadAttr::InProcessScope ( void  )
inline

Definition at line 97 of file PthreadAttr.h.

References ScheduleScope().

97 { return ScheduleScope() == PTHREAD_SCOPE_PROCESS; }
int ScheduleScope(void)
Definition: PthreadAttr.cc:217

+ Here is the call graph for this function:

int PthreadAttr::InSystemScope ( void  )
inline

Definition at line 96 of file PthreadAttr.h.

References ScheduleScope().

96 { return ScheduleScope() == PTHREAD_SCOPE_SYSTEM; }
int ScheduleScope(void)
Definition: PthreadAttr.cc:217

+ Here is the call graph for this function:

int PthreadAttr::Joinable ( void  )
inline

Definition at line 54 of file PthreadAttr.h.

References DetachState().

54 { return DetachState() == PTHREAD_CREATE_JOINABLE; }
int DetachState(void)
Definition: PthreadAttr.cc:67

+ Here is the call graph for this function:

PthreadAttr::operator const pthread_attr_t * ( void  ) const
inline

Definition at line 48 of file PthreadAttr.h.

References attr.

48 { return &attr; }
pthread_attr_t attr
Definition: PthreadAttr.h:100
PthreadAttr::operator pthread_attr_t * ( void  )
inline

Definition at line 47 of file PthreadAttr.h.

References attr.

47 { return &attr; }
pthread_attr_t attr
Definition: PthreadAttr.h:100
void PthreadAttr::ProcessScope ( void  )
inline

Definition at line 95 of file PthreadAttr.h.

References ScheduleScope().

95 { ScheduleScope(PTHREAD_SCOPE_PROCESS); }
int ScheduleScope(void)
Definition: PthreadAttr.cc:217

+ Here is the call graph for this function:

int PthreadAttr::ScheduleScope ( int  scope)
private

Definition at line 209 of file PthreadAttr.cc.

References attr, and PthreadErrorHandler::TrapError().

211 {
212  TrapError(pthread_attr_setscope(&attr, scope));
213  return scope;
214 }
pthread_attr_t attr
Definition: PthreadAttr.h:100
void TrapError(int result)

+ Here is the call graph for this function:

int PthreadAttr::ScheduleScope ( void  )
private

Definition at line 217 of file PthreadAttr.cc.

References attr, and PthreadErrorHandler::TrapError().

Referenced by InProcessScope(), InSystemScope(), ProcessScope(), and SystemScope().

219 { int scope;
220  TrapError(pthread_attr_getscope(&attr, &scope));
221  return scope;
222 }
pthread_attr_t attr
Definition: PthreadAttr.h:100
void TrapError(int result)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void PthreadAttr::SystemScope ( void  )
inline

Definition at line 94 of file PthreadAttr.h.

References ScheduleScope().

Referenced by PthreadAttr().

94 { ScheduleScope(PTHREAD_SCOPE_SYSTEM); }
int ScheduleScope(void)
Definition: PthreadAttr.cc:217

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void PthreadErrorHandler::TrapError ( int  result)
inlineprotectedinherited

Member Data Documentation

pthread_attr_t PthreadAttr::attr
private
int PthreadErrorHandler::error
protectedinherited
int PthreadAttr::referenceCount
private

Definition at line 101 of file PthreadAttr.h.

Referenced by PthreadAttr(), and ~PthreadAttr().


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