Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   Related Pages  

Wefts::OSThreadPthread Class Reference
[OS Threading Level Abstraction.]

Wraps Posix threads. More...

#include <wefts_os_pthread.h>

Inheritance diagram for Wefts::OSThreadPthread:

Inheritance graph
[legend]
Collaboration diagram for Wefts::OSThreadPthread:

Collaboration graph
[legend]
List of all members.

Public Methods

 OSThreadPthread ()
 OSThreadPthread (bool val)
bool start (void *(*func)(void *), void *data)
 Starts OS specific thread OS dependant implementation must provide a valid function to execute the thread; Thread.cpp has already some valid ones.

bool stop ()
 Stop this OS specific thread.

void * join () throw ( NotJoinableError )
 Joins this OS Specific threads.

int enableCancel ()
 Enables cancelation: This function returns the old status on success, that can be later reset with setCancelStatus.

int disableCancel ()
 Disables cancelation.

bool setCancelState (int state)
 Raw function to set the cancel type.

void testCancel ()
 Kill the thread on OS level cancelation.

void setCancelDeferred ()
 Tells the thread that it must use deferred cancelation.

void detach ()
 Detach thread.

void exit (void *data)
 Exit the thread.

bool same () const
 Returns true if the currently running thread and this objects are the same.

bool equal (const OSThreadBase &th) const
 Returns true if this object is equal (on OS opinion) to the parameter.

virtual bool setCurrent ()
 Change this thread object to the current OS dependant thread.

virtual void invalidate ()

Private Attributes

pthread_t m_thid
 posix thread id

bool m_valid
 true if this thread is considered valid


Detailed Description

Wraps Posix threads.

See also:
OS Threading Abstraction (and Independence) Layer


Constructor & Destructor Documentation

Wefts::OSThreadPthread::OSThreadPthread   [inline]
 

Wefts::OSThreadPthread::OSThreadPthread bool    val [inline]
 


Member Function Documentation

void Wefts::OSThreadPthread::detach   [inline, virtual]
 

Detach thread.

Note:
Wefts detaching differs from pthread detaching; a wefts detached thread is just a thread whose class data will be automatically destroyed on termination (and that can't be joined).
See also:
Thread::detach()

Implements Wefts::OSThreadBase.

int Wefts::OSThreadPthread::disableCancel   [inline, virtual]
 

Disables cancelation.

Wokrs like enableCancel.

See also:
enableCancel()

Implements Wefts::OSThreadBase.

int Wefts::OSThreadPthread::enableCancel   [inline, virtual]
 

Enables cancelation: This function returns the old status on success, that can be later reset with setCancelStatus.

On error, return type is undefined.

Note:
a candidate for exception rising.
Todo:
write a low-level exception system.

Implements Wefts::OSThreadBase.

bool Wefts::OSThreadPthread::equal const OSThreadBase   th const [inline, virtual]
 

Returns true if this object is equal (on OS opinion) to the parameter.

Implements Wefts::OSThreadBase.

void Wefts::OSThreadPthread::exit void *    data [inline, virtual]
 

Exit the thread.

Run() can call this method instead of retunring a void *; the effect is the same.

Implements Wefts::OSThreadBase.

virtual void Wefts::OSThreadPthread::invalidate   [inline, virtual]
 

Implements Wefts::OSThreadBase.

void* Wefts::OSThreadPthread::join   throw ( NotJoinableError ) [inline, virtual]
 

Joins this OS Specific threads.

Implements Wefts::OSThreadBase.

bool Wefts::OSThreadPthread::same   [inline, virtual]
 

Returns true if the currently running thread and this objects are the same.

Implements Wefts::OSThreadBase.

void Wefts::OSThreadPthread::setCancelDeferred   [inline, virtual]
 

Tells the thread that it must use deferred cancelation.

The OS may provide deferred cancelation schemes natively, or not. In the latter case, deferred cancelation must be emulated; See Cancellation Issues.

Implements Wefts::OSThreadBase.

bool Wefts::OSThreadPthread::setCancelState int    state [inline, virtual]
 

Raw function to set the cancel type.

This function should be used only with the integer returned by enableCancel() and disableCancel(), as no assumption can be made about what the meaning of the parameter could be in different environments.

Parameters:
state  system dependant (that is to say: don't touch it).
Returns:
true on success

Implements Wefts::OSThreadBase.

virtual bool Wefts::OSThreadPthread::setCurrent   [inline, virtual]
 

Change this thread object to the current OS dependant thread.

It makes so that all the internal variables are set to reflect this current thread. In some implementation, updating of some variables my be deferred to a later moment; the important thing is to change the thread type.

Implements Wefts::OSThreadBase.

bool Wefts::OSThreadPthread::start void *(*    func)(void *),
void *    data
[inline, virtual]
 

Starts OS specific thread OS dependant implementation must provide a valid function to execute the thread; Thread.cpp has already some valid ones.

Parameters:
func  the function to be executed in parallel thread.
data  the data to be passed to os-level thread function

Implements Wefts::OSThreadBase.

bool Wefts::OSThreadPthread::stop   [inline, virtual]
 

Stop this OS specific thread.

Implements Wefts::OSThreadBase.

void Wefts::OSThreadPthread::testCancel   [inline, virtual]
 

Kill the thread on OS level cancelation.

Implements Wefts::OSThreadBase.


Member Data Documentation

pthread_t Wefts::OSThreadPthread::m_thid [private]
 

posix thread id

bool Wefts::OSThreadPthread::m_valid [private]
 

true if this thread is considered valid


The documentation for this class was generated from the following file:
Generated on Mon Aug 18 05:53:47 2003 for Wefts by doxygen1.2.18