#include <wefts_os_pthread.h>
Inheritance diagram for Wefts::OSThreadPthread:
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. | |
virtual void | osRun (void(*runner)(void *), void *data, void(*cleaner)(void *)) |
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. | |
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 |
|
|
|
|
|
Detach thread.
Implements Wefts::OSThreadBase. |
|
Disables cancelation. Wokrs like enableCancel.
Implements Wefts::OSThreadBase. |
|
Enables cancelation: This function returns the old status on success, that can be later reset with setCancelStatus. On error, return type is undefined.
Implements Wefts::OSThreadBase. |
|
Returns true if this object is equal (on OS opinion) to the parameter.
Implements Wefts::OSThreadBase. |
|
Exit the thread. Run() can call this method instead of retunring a void *; the effect is the same. Implements Wefts::OSThreadBase. |
|
Implements Wefts::OSThreadBase. |
|
Joins this OS Specific threads.
Implements Wefts::OSThreadBase. |
|
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. Implements Wefts::OSThreadBase. |
|
Returns true if the currently running thread and this objects are the same.
Implements Wefts::OSThreadBase. |
|
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. Implements Wefts::OSThreadBase. |
|
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.
Implements Wefts::OSThreadBase. |
|
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. |
|
Starts OS specific thread OS dependant implementation must provide a valid function to execute the thread; Thread.cpp has already some valid ones.
Implements Wefts::OSThreadBase. |
|
Stop this OS specific thread.
Implements Wefts::OSThreadBase. |
|
Kill the thread on OS level cancelation.
Implements Wefts::OSThreadBase. |
|
posix thread id
|
|
true if this thread is considered valid
|