rpa::posix_thread Class Reference

#include <posix.h>

List of all members.

Public Types

typedef pthread_t id_t

Public Member Functions

 posix_thread ()
 A cheap constructor.
 ~posix_thread ()
 The thread may be still running (But this would be a bug...).
int create (posix_fun_ptr aFunc, void *aData)
void cancel (void)
void join (void)
bool exec_lock (void)

Static Public Member Functions

static id_t self (void)

Private Member Functions

 posix_thread (const posix_thread &)
 Threads are not copiable, nor assignable.
posix_threadoperator= (const posix_thread &)

Private Attributes

pthread_t _thread
 The actual POSIX thread.
bool _created


Detailed Description

This is a wrapper class transforming a POSIX 'pthread' thread, into an object conformant to the required interface. This is a straightforward implementation, which creates and destroys threads as required, without a pool. Therefore, not very efficient, but easy for debugging. If a threads pool is needed, it is possible to encapsulate this thread class with an adapter still providing the same interface, but managing internall, a threads pool.


Member Typedef Documentation

typedef pthread_t rpa::posix_thread::id_t


Constructor & Destructor Documentation

rpa::posix_thread::posix_thread ( const posix_thread  )  [private]

Threads are not copiable, nor assignable.

rpa::posix_thread::posix_thread (  ) 

A cheap constructor.

rpa::posix_thread::~posix_thread (  ) 

The thread may be still running (But this would be a bug...).


Member Function Documentation

void rpa::posix_thread::cancel ( void   ) 

int rpa::posix_thread::create ( posix_fun_ptr  aFunc,
void *  aData 
)

If there are not enough resources to create a new thread, it is possible to call the function in the current thread.

bool rpa::posix_thread::exec_lock ( void   ) 

void rpa::posix_thread::join ( void   ) 

posix_thread& rpa::posix_thread::operator= ( const posix_thread  )  [private]

static id_t rpa::posix_thread::self ( void   )  [inline, static]

Returns the id of the current thread. It is not mandatory to implement this member.


Member Data Documentation

bool rpa::posix_thread::_created [private]

pthread_t rpa::posix_thread::_thread [private]

The actual POSIX thread.


The documentation for this class was generated from the following files:
Generated on Tue Sep 25 10:20:34 2007 for rpa by  doxygen 1.4.7