CPN
Computational Process Networks
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
PthreadKey< T > Class Template Reference

#include <PthreadKey.h>

+ Inheritance diagram for PthreadKey< T >:
+ Collaboration diagram for PthreadKey< T >:

Public Member Functions

 PthreadKey (void(*destructor)(T)=0)
 
 ~PthreadKey (void)
 
 operator pthread_key_t * (void)
 
 operator const pthread_key_t * (void) const
 
Get (void) const
 
PthreadKey< T > & Set (T val)
 
int Error (void)
 
void Clear (void)
 

Protected Member Functions

void TrapError (int result)
 

Protected Attributes

int error
 

Private Attributes

pthread_key_t theKey
 

Detailed Description

template<class T>
class PthreadKey< T >

Definition at line 35 of file PthreadKey.h.

Constructor & Destructor Documentation

template<class T >
PthreadKey< T >::PthreadKey ( void(*)(T)  destructor = 0)
inline

Definition at line 37 of file PthreadKey.h.

References PthreadKey< T >::theKey, and PthreadErrorHandler::TrapError().

38  { TrapError(pthread_key_create(&theKey, (void(*)(void*))destructor)); }
void TrapError(int result)
pthread_key_t theKey
Definition: PthreadKey.h:54

+ Here is the call graph for this function:

template<class T >
PthreadKey< T >::~PthreadKey ( void  )
inline

Definition at line 39 of file PthreadKey.h.

References PthreadKey< T >::theKey, and PthreadErrorHandler::TrapError().

40  { try { TrapError(pthread_key_delete(theKey)); } catch (...) { std::terminate(); } }
void TrapError(int result)
pthread_key_t theKey
Definition: PthreadKey.h:54

+ Here is the call graph for this function:

Member Function Documentation

void PthreadErrorHandler::Clear ( void  )
inlineinherited

Definition at line 40 of file PthreadErrorHandler.h.

References PthreadErrorHandler::error.

40 { error = 0; }
int PthreadErrorHandler::Error ( void  )
inlineinherited

Definition at line 39 of file PthreadErrorHandler.h.

References PthreadErrorHandler::error.

39 { return error; }
template<class T >
T PthreadKey< T >::Get ( void  ) const
inline

Definition at line 45 of file PthreadKey.h.

References PthreadKey< T >::theKey.

46  { return (T)pthread_getspecific(theKey); }
pthread_key_t theKey
Definition: PthreadKey.h:54
template<class T >
PthreadKey< T >::operator const pthread_key_t * ( void  ) const
inline

Definition at line 43 of file PthreadKey.h.

References PthreadKey< T >::theKey.

43 { return &theKey; }
pthread_key_t theKey
Definition: PthreadKey.h:54
template<class T >
PthreadKey< T >::operator pthread_key_t * ( void  )
inline

Definition at line 42 of file PthreadKey.h.

References PthreadKey< T >::theKey.

42 { return &theKey; }
pthread_key_t theKey
Definition: PthreadKey.h:54
template<class T >
PthreadKey<T>& PthreadKey< T >::Set ( val)
inline

Definition at line 48 of file PthreadKey.h.

References PthreadKey< T >::theKey, and PthreadErrorHandler::TrapError().

49  { TrapError(pthread_setspecific(theKey, (void*)val));
50  return *this;
51  }
void TrapError(int result)
pthread_key_t theKey
Definition: PthreadKey.h:54

+ Here is the call graph for this function:

void PthreadErrorHandler::TrapError ( int  result)
inlineprotectedinherited

Member Data Documentation

int PthreadErrorHandler::error
protectedinherited
template<class T >
pthread_key_t PthreadKey< T >::theKey
private

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