#include <LOW_thread_thread.h>
Inheritance diagram for LOW_thread_thread:
Public Member Functions | |
class_DERIVE_FROM_EXCEPTION (thread_thread_error, LOW_exception) | |
Exception base class for all exceptions thrown by LOW_thread_thread. | |
class_DERIVE_FROM_EXCEPTION (thread_thread_permission, thread_thread_error) | |
Exception class indicating insufficient access rights. | |
class_DERIVE_FROM_EXCEPTION (thread_thread_notAvailable, thread_thread_error) | |
Exception class indicating that an option method is not implemented. | |
virtual | ~LOW_thread_thread () |
Destructor. | |
Methods callable by any thread. | |
virtual bool | getIsStarted () const=0 |
Indicates if the thread was started. | |
virtual bool | getIsTerminated () const=0 |
Indicates if the thread has terminated. | |
virtual int | getReturnValue () const=0 |
Get the return value of the thread. | |
virtual void | create ()=0 |
Actually create the thread and starts it's runnable's run() method. | |
virtual void | cancel ()=0 |
Cancel the execution of the thread. | |
virtual int | join ()=0 |
Wait for the termination of the thread. | |
virtual bool | getDetachAvialable () const |
Indicate if thread detaching is available. | |
virtual void | detach () |
Put a running thread in the detached state. | |
virtual bool | getScheduleModifyAvailable () const |
Indicate if thread scheduling modification is available. | |
virtual void | setScheduling (const LOW_thread_Factory::schedPolicy_t inPolicy, const LOW_thread_Factory::schedPrio_t inPrio) |
Set policy and parameter of scheduling. | |
virtual LOW_thread_Factory::schedPolicy_t | getSchedPolicy () const |
Get the scheduling policy. | |
virtual LOW_thread_Factory::schedPrio_t | getSchedPrio () const |
Get the scheduling parameter. | |
virtual bool | getCancelAttribsAvialable () const |
Indicate if thread cancelling attributes are available. | |
virtual LOW_thread_Factory::cancelAttrib_t | getCancelAttrib () const |
Get cancelling behaviour. | |
Methods only callable by the own thread. | |
virtual void | thread_exit (const int inRetVal)=0 |
Terminate the calling thread. | |
virtual void | testCancel ()=0 |
Test on pending cancellation. | |
virtual void | setCancelAttrib (const LOW_thread_Factory::cancelAttrib_t inCancelAttrib) |
Set cancelling behaviour. | |
Static Private Member Functions | |
void * | threadRunner (void *) |
Helper method for thread launching. |
Each instance represents one thread.
Specific platforms dereive their implementation classes from this class. This interface is strongly inspired by the abilities of POSIX threads. As not all OS specific threads have the same abilities, implementation of some methods are optional. Methods are marked accordingly. The default implementation of optional methods just throw a thread_thread_notAvailable exception.
Optional methods are mainly related to the following features:
The instances are created by LOW_thread_Factory, following the factory design pattern.
This class is thread-safe.
Parts of the documentation taken from Linux man pages by Xavier Leroy.
Parts of the documentation taken from IEEE Standard 1003.1-2003.
Definition at line 53 of file LOW_thread_thread.h.
|
Destructor.
Definition at line 27 of file LOW_thread_thread.cpp. |
|
Cancel the execution of the thread. Note that the thread is not forced to quit. It depends on the thread implementation when or or if anyway a cancellation request is honored. Implementation is mandatory.
Implemented in LOW_thread_thread_POSIX. |
|
Exception class indicating that an option method is not implemented.
|
|
Exception class indicating insufficient access rights.
|
|
Exception base class for all exceptions thrown by LOW_thread_thread.
|
|
Actually create the thread and starts it's runnable's run() method. The new thread terminates either explicitly, by calling thread_exit(), or implicitly, by returning from the run() method. The latter case is equivalent to calling thread_exit() with the result returned by run() as exit code. Implementation is mandatory.
Implemented in LOW_thread_thread_POSIX. |
|
Put a running thread in the detached state. Implementation is optional.
Reimplemented in LOW_thread_thread_POSIX. Definition at line 43 of file LOW_thread_thread.cpp. |
|
Get cancelling behaviour. Implementation is optional.
Reimplemented in LOW_thread_thread_POSIX. Definition at line 79 of file LOW_thread_thread.cpp. |
|
Indicate if thread cancelling attributes are available.
Definition at line 73 of file LOW_thread_thread.cpp. |
|
Indicate if thread detaching is available.
Definition at line 37 of file LOW_thread_thread.cpp. |
|
Indicates if the thread was started. Implementation is mandatory.
Implemented in LOW_thread_thread_POSIX. |
|
Indicates if the thread has terminated. Implementation is mandatory.
Implemented in LOW_thread_thread_POSIX. |
|
Get the return value of the thread. Implementation is mandatory.
Implemented in LOW_thread_thread_POSIX. |
|
Get the scheduling policy.
Reimplemented in LOW_thread_thread_POSIX. Definition at line 61 of file LOW_thread_thread.cpp. |
|
Get the scheduling parameter.
Reimplemented in LOW_thread_thread_POSIX. Definition at line 67 of file LOW_thread_thread.cpp. |
|
Indicate if thread scheduling modification is available.
Definition at line 49 of file LOW_thread_thread.cpp. |
|
Wait for the termination of the thread. Suspends the execution of the calling thread until the thread terminates, either by calling thread_exit() or by being cancelled. Implementation is mandatory.
Implemented in LOW_thread_thread_POSIX. |
|
Set cancelling behaviour. Changes the cancellation state for the calling thread -- that is, whether cancellation requests are ignored or not and when they are handled. Implementation is optional.
Reimplemented in LOW_thread_thread_POSIX. Definition at line 85 of file LOW_thread_thread.cpp. |
|
Set policy and parameter of scheduling.
Reimplemented in LOW_thread_thread_POSIX. Definition at line 55 of file LOW_thread_thread.cpp. |
|
Test on pending cancellation. Method does nothing except testing for pending cancellation and executing it. Its purpose is to introduce explicit checks for cancellation in long sequences of code that do not call cancellation point functions otherwise. Implementation is mandatory.
Implemented in LOW_thread_thread_POSIX. |
|
Terminate the calling thread. Method can only be called by the own thread. Implementation is mandatory.
Implemented in LOW_thread_thread_POSIX. |
|
Helper method for thread launching. This method gives the possibility to interface with OS-specific calls which require C-style linkage conventions. Note that when imlementing such a method, special care about thread-safety must be taken. Reimplemented in LOW_thread_thread_POSIX. |