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

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

Thread OS layer abstraction This class can be rewritten in other header files to implement different os specific threading system. More...

#include <wefts_os_base.h>

Inheritance diagram for Wefts::OSThreadBase:

Inheritance graph
[legend]
List of all members.

Public Methods

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

virtual bool stop ()=0
 Stop this OS specific thread.

virtual void * join ()=0
 Joins this OS Specific threads.

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

virtual int disableCancel ()=0
 Disables cancelation.

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

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

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

virtual void detach ()=0
 Detach thread.

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

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

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

virtual void invalidate ()=0
virtual bool operator== (OSThreadBase &th)
 Pass the test to equal().

virtual bool operator!= (OSThreadBase &th)
 Pass the thest to ! equal().


Protected Methods

 OSThreadBase ()
 Newly created thread.

 OSThreadBase (bool)
 Already running thread.

virtual void exit (void *data)=0
 Exit the thread.


Detailed Description

Thread OS layer abstraction This class can be rewritten in other header files to implement different os specific threading system.

See also:
OS Threading Abstraction (and Independence) Layer


Constructor & Destructor Documentation

Wefts::OSThreadBase::OSThreadBase   [inline, protected]
 

Newly created thread.

Subclassess must calll invalidate() member to specify that the current thread is still not running.

Wefts::OSThreadBase::OSThreadBase bool    [inline, protected]
 

Already running thread.

Call this constructor if you need to have a reference to the thread that is currently running; this will set the OSThreadBase internal data as if a start were called at some point.


Member Function Documentation

virtual void Wefts::OSThreadBase::detach   [pure 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()

Implemented in Wefts::OSThreadPthread.

virtual int Wefts::OSThreadBase::disableCancel   [pure virtual]
 

Disables cancelation.

Wokrs like enableCancel.

See also:
enableCancel()

Implemented in Wefts::OSThreadPthread.

virtual int Wefts::OSThreadBase::enableCancel   [pure 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.

Implemented in Wefts::OSThreadPthread.

virtual bool Wefts::OSThreadBase::equal const OSThreadBase &    th const [pure virtual]
 

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

Implemented in Wefts::OSThreadPthread.

virtual void Wefts::OSThreadBase::exit void *    data [protected, pure virtual]
 

Exit the thread.

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

Implemented in Wefts::OSThreadPthread.

virtual void Wefts::OSThreadBase::invalidate   [pure virtual]
 

Implemented in Wefts::OSThreadPthread.

virtual void* Wefts::OSThreadBase::join   [pure virtual]
 

Joins this OS Specific threads.

Implemented in Wefts::OSThreadPthread.

virtual bool Wefts::OSThreadBase::operator!= OSThreadBase &    th [inline, virtual]
 

Pass the thest to ! equal().

virtual bool Wefts::OSThreadBase::operator== OSThreadBase &    th [inline, virtual]
 

Pass the test to equal().

virtual bool Wefts::OSThreadBase::same   [pure virtual]
 

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

Implemented in Wefts::OSThreadPthread.

virtual void Wefts::OSThreadBase::setCancelDeferred   [pure 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.

Implemented in Wefts::OSThreadPthread.

virtual bool Wefts::OSThreadBase::setCancelState int    state [pure 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

Implemented in Wefts::OSThreadPthread.

virtual bool Wefts::OSThreadBase::setCurrent   [pure 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.

Implemented in Wefts::OSThreadPthread.

virtual bool Wefts::OSThreadBase::start void *(*    func)(void *),
void *    data
[pure 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

Implemented in Wefts::OSThreadPthread.

virtual bool Wefts::OSThreadBase::stop   [pure virtual]
 

Stop this OS specific thread.

Implemented in Wefts::OSThreadPthread.

virtual void Wefts::OSThreadBase::testCancel   [pure virtual]
 

Kill the thread on OS level cancelation.

Implemented in Wefts::OSThreadPthread.


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