CPN
Computational Process Networks
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PthreadBase Class Reference

#include <PthreadBase.h>

+ Inheritance diagram for PthreadBase:
+ Collaboration diagram for PthreadBase:

Classes

class  CancelProtected
 

Public Member Functions

 PthreadBase (void)
 
 PthreadBase (pthread_t thread)
 
 PthreadBase (void *(*entryFunc)(void *), void *arg=0)
 
 PthreadBase (PthreadAttr &attr, void *(*entryFunc)(void *), void *arg=0)
 
 operator pthread_t * (void)
 
 operator pthread_t (void)
 
int operator== (pthread_t t2)
 
void * Join (void)
 
int Detach (void)
 
int Cancel (void)
 
int SendSignal (int sig)
 
int Kill (int sig)
 
int Error (void)
 
void Clear (void)
 

Static Public Member Functions

static pthread_t Self (void)
 
static void TestCancel (void)
 
static void Exit (void *value)
 
static int SendSignal (pthread_t thd, int sig)
 
static int Kill (pthread_t thd, int sig)
 
static int GetSignalMask (sigset_t *oldSet)
 
static int SetSignalMask (const sigset_t *set, sigset_t *oldSet=0)
 
static int BlockSignals (const sigset_t *set, sigset_t *oldSet=0)
 
static int UnblockSignals (const sigset_t *set, sigset_t *oldSet=0)
 
static int CancelEnable (void)
 
static int CancelDisable (void)
 
static int CancelDeferred (void)
 
static int CancelAsynchronous (void)
 

Protected Member Functions

void TrapError (int result)
 

Protected Attributes

pthread_t theThread
 
int error
 

Detailed Description

Definition at line 41 of file PthreadBase.h.

Constructor & Destructor Documentation

PthreadBase::PthreadBase ( void  )

Definition at line 34 of file PthreadBase.cc.

References Self(), and theThread.

36 {
37  theThread = Self();
38 }
static pthread_t Self(void)
Definition: PthreadBase.h:61
pthread_t theThread
Definition: PthreadBase.h:126

+ Here is the call graph for this function:

PthreadBase::PthreadBase ( pthread_t  thread)

Definition at line 42 of file PthreadBase.cc.

References theThread.

44 {
45  theThread = thread;
46 }
pthread_t theThread
Definition: PthreadBase.h:126
PthreadBase::PthreadBase ( void *(*)(void *)  entryFunc,
void *  arg = 0 
)

Definition at line 50 of file PthreadBase.cc.

References theThread, and PthreadErrorHandler::TrapError().

52 {
53  TrapError( pthread_create( (pthread_t*)&theThread, 0, entryFunc, arg) );
54 }
void TrapError(int result)
pthread_t theThread
Definition: PthreadBase.h:126

+ Here is the call graph for this function:

PthreadBase::PthreadBase ( PthreadAttr attr,
void *(*)(void *)  entryFunc,
void *  arg = 0 
)

Definition at line 58 of file PthreadBase.cc.

References theThread, and PthreadErrorHandler::TrapError().

60 {
61  TrapError( pthread_create( (pthread_t*)&theThread, (pthread_attr_t*)attr, entryFunc, arg) );
62 }
void TrapError(int result)
pthread_t theThread
Definition: PthreadBase.h:126

+ Here is the call graph for this function:

Member Function Documentation

static int PthreadBase::BlockSignals ( const sigset_t *  set,
sigset_t *  oldSet = 0 
)
inlinestatic

Definition at line 77 of file PthreadBase.h.

78  { return pthread_sigmask(SIG_BLOCK, set, oldSet); }
int PthreadBase::Cancel ( void  )
inline

Definition at line 59 of file PthreadBase.h.

References theThread.

59 { return pthread_cancel(theThread); }
pthread_t theThread
Definition: PthreadBase.h:126
int PthreadBase::CancelAsynchronous ( void  )
static

Definition at line 105 of file PthreadBase.cc.

107 {
108  int oldState;
109  pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldState);
110  return oldState;
111 }
int PthreadBase::CancelDeferred ( void  )
static

Definition at line 95 of file PthreadBase.cc.

97 {
98  int oldState;
99  pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldState);
100  return oldState;
101 }
int PthreadBase::CancelDisable ( void  )
static

Definition at line 86 of file PthreadBase.cc.

88 {
89  int oldState;
90  pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldState);
91  return oldState;
92 }
int PthreadBase::CancelEnable ( void  )
static

Definition at line 76 of file PthreadBase.cc.

78 {
79  int oldState;
80  pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &oldState);
81  return oldState;
82 }
void PthreadErrorHandler::Clear ( void  )
inlineinherited

Definition at line 40 of file PthreadErrorHandler.h.

References PthreadErrorHandler::error.

40 { error = 0; }
int PthreadBase::Detach ( void  )
inline

Definition at line 58 of file PthreadBase.h.

References theThread.

58 { return pthread_detach(theThread); }
pthread_t theThread
Definition: PthreadBase.h:126
int PthreadErrorHandler::Error ( void  )
inlineinherited

Definition at line 39 of file PthreadErrorHandler.h.

References PthreadErrorHandler::error.

39 { return error; }
static void PthreadBase::Exit ( void *  value)
inlinestatic

Definition at line 64 of file PthreadBase.h.

64 { pthread_exit(value); }
static int PthreadBase::GetSignalMask ( sigset_t *  oldSet)
inlinestatic

Definition at line 73 of file PthreadBase.h.

74  { return pthread_sigmask(SIG_SETMASK, 0, oldSet); }
void * PthreadBase::Join ( void  )

Definition at line 66 of file PthreadBase.cc.

References theThread, and PthreadErrorHandler::TrapError().

68 {
69  void* result = 0;
70  TrapError( pthread_join(theThread, &result) );
71  return result;
72 }
void TrapError(int result)
pthread_t theThread
Definition: PthreadBase.h:126

+ Here is the call graph for this function:

int PthreadBase::Kill ( int  sig)
inline

Definition at line 68 of file PthreadBase.h.

References theThread.

68 { return pthread_kill(theThread, sig); }
pthread_t theThread
Definition: PthreadBase.h:126
static int PthreadBase::Kill ( pthread_t  thd,
int  sig 
)
inlinestatic

Definition at line 71 of file PthreadBase.h.

71 { return pthread_kill(thd, sig); }
PthreadBase::operator pthread_t ( void  )
inline

Definition at line 52 of file PthreadBase.h.

References theThread.

52 { return theThread; }
pthread_t theThread
Definition: PthreadBase.h:126
PthreadBase::operator pthread_t * ( void  )
inline

Definition at line 51 of file PthreadBase.h.

References theThread.

51 { return &theThread; }
pthread_t theThread
Definition: PthreadBase.h:126
int PthreadBase::operator== ( pthread_t  t2)
inline

Definition at line 54 of file PthreadBase.h.

References theThread.

54 { return pthread_equal(theThread, t2); }
pthread_t theThread
Definition: PthreadBase.h:126
static pthread_t PthreadBase::Self ( void  )
inlinestatic

Definition at line 61 of file PthreadBase.h.

Referenced by PthreadBase().

61 { return pthread_self(); }

+ Here is the caller graph for this function:

int PthreadBase::SendSignal ( int  sig)
inline

Definition at line 67 of file PthreadBase.h.

References theThread.

67 { return pthread_kill(theThread, sig); }
pthread_t theThread
Definition: PthreadBase.h:126
static int PthreadBase::SendSignal ( pthread_t  thd,
int  sig 
)
inlinestatic

Definition at line 70 of file PthreadBase.h.

70 { return pthread_kill(thd, sig); }
static int PthreadBase::SetSignalMask ( const sigset_t *  set,
sigset_t *  oldSet = 0 
)
inlinestatic

Definition at line 75 of file PthreadBase.h.

76  { return pthread_sigmask(SIG_SETMASK, set, oldSet); }
static void PthreadBase::TestCancel ( void  )
inlinestatic

Definition at line 63 of file PthreadBase.h.

Referenced by Pthread::PthreadEntryPoint().

63 { pthread_testcancel(); }

+ Here is the caller graph for this function:

void PthreadErrorHandler::TrapError ( int  result)
inlineprotectedinherited
static int PthreadBase::UnblockSignals ( const sigset_t *  set,
sigset_t *  oldSet = 0 
)
inlinestatic

Definition at line 79 of file PthreadBase.h.

80  { return pthread_sigmask(SIG_UNBLOCK, set, oldSet); }

Member Data Documentation

int PthreadErrorHandler::error
protectedinherited
pthread_t PthreadBase::theThread
protected

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