#include <wefts_os_base.h>
Inheritance diagram for Wefts::OSThreadBase:
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 void | emuDeferredStart () |
Starts emulated deferred cancelation. | |
virtual void | emuDeferredEnd () |
End emulated deferred cancelation. | |
virtual void | osRun (void(*func)(void *), void *data, void(*cleanup)(void *))=0 |
Executes a procedure under the hood of a cleanup procedure This method requires the underlying OS threading system to set up a single cleanup procedure, execute the procedure "func" and then call the cleanup procedure; if the thread is canceled, os system must provide. | |
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 test to ! equal(). | |
Protected Methods | |
OSThreadBase () | |
Newly created thread. | |
OSThreadBase (bool) | |
Already running thread. | |
virtual void | exit (void *data)=0 |
Exit the thread. |
|
Newly created thread. Subclassess must calll invalidate() member to specify that the current thread is still not running. |
|
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. |
|
Detach thread.
Implemented in Wefts::OSThreadPthread, and Wefts::OSThreadWindows. |
|
Disables cancelation. Wokrs like enableCancel.
Implemented in Wefts::OSThreadPthread, and Wefts::OSThreadWindows. |
|
End emulated deferred cancelation. In base class, it does nothing. If the os does support natively the deferred cancelation scheme, this function is useless.
|
|
Starts emulated deferred cancelation. In base class, it does nothing. If the os does support natively the deferred cancelation scheme, this function is useless.
|
|
Enables cancelation: This function returns the old status on success, that can be later reset with setCancelStatus. On error, return type is undefined.
Implemented in Wefts::OSThreadPthread, and Wefts::OSThreadWindows. |
|
Returns true if this object is equal (on OS opinion) to the parameter.
Implemented in Wefts::OSThreadPthread, and Wefts::OSThreadWindows. |
|
Exit the thread. Run() can call this method instead of retunring a void *; the effect is the same. Implemented in Wefts::OSThreadPthread, and Wefts::OSThreadWindows. |
|
Implemented in Wefts::OSThreadPthread, and Wefts::OSThreadWindows. |
|
Joins this OS Specific threads.
Implemented in Wefts::OSThreadPthread, and Wefts::OSThreadWindows. |
|
Pass the test to ! equal().
|
|
Pass the test to equal().
|
|
Executes a procedure under the hood of a cleanup procedure This method requires the underlying OS threading system to set up a single cleanup procedure, execute the procedure "func" and then call the cleanup procedure; if the thread is canceled, os system must provide. "data" to the cleanup procedure and exit cleanly. Data is actually a Wefts::Thread or derived object, but the data must be considered opaque to os layer. Currently func() is only a wrapper to call data->run(), but this may change in the future. Implemented in Wefts::OSThreadPthread, and Wefts::OSThreadWindows. |
|
Returns true if the currently running thread and this objects are the same.
Implemented in Wefts::OSThreadPthread, and Wefts::OSThreadWindows. |
|
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. When OS does not provides inbound deferred cancelation, this routine must do nothing. Implemented in Wefts::OSThreadPthread, and Wefts::OSThreadWindows. |
|
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.
Implemented in Wefts::OSThreadPthread, and Wefts::OSThreadWindows. |
|
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, and Wefts::OSThreadWindows. |
|
Starts OS specific thread OS dependant implementation must provide a valid function to execute the thread; Thread.cpp has already some valid ones.
Implemented in Wefts::OSThreadPthread, and Wefts::OSThreadWindows. |
|
Stop this OS specific thread.
Implemented in Wefts::OSThreadPthread, and Wefts::OSThreadWindows. |
|
Kill the thread on OS level cancelation.
Implemented in Wefts::OSThreadPthread, and Wefts::OSThreadWindows. |