#include <thread.h>


Public Member Functions | |
| Thread () | |
| Constructs a new thread. | |
| virtual | ~Thread () |
| Destructs the thread. | |
| bool | start () |
| Starts the thread. | |
| virtual bool | init () |
| The init function for the child thread. | |
| virtual void * | run ()=0 |
| The entry function for the child thread. | |
| virtual void | exit (void *retVal=0) |
| Exit the child thread immediately. | |
| void | cancel () |
| Cancel (stop) the child thread. | |
| bool | join (void **retVal=0) |
| Wait for the exit of the child thread. | |
| bool | isStopped () const |
| Return if the thread is stopped. | |
| bool | isRunning () const |
| Return if the thread is running. | |
| bool | isCurrent () const |
| Returns if this thread object is the current (calling) thread. | |
Static Public Member Functions | |
| static void | addListener (ExecutionListener *listener) |
| Add a new thread state listener. | |
| static bool | removeListener (ExecutionListener *listener) |
| Remove a thread state listener. | |
| static void | removeAllListeners () |
| Remove all registered listeners, used at exit. | |
| static size_t | getSelfThreadID () |
| static void | pinCurrentThread () |
Friends | |
| void | _notifyStopping (void *) |
| std::ostream & | operator<< (std::ostream &os, const Thread *) |
| Print the thread to the given output stream. | |
Definition at line 42 of file thread.h.
| eq::base::Thread::~Thread | ( | ) | [virtual] |
| bool eq::base::Thread::start | ( | ) |
Starts the thread.
All thread state listeners will be notified from the running thread, after the thread was initialized successfully.
true if the thread was launched, false otherwise. Definition at line 182 of file thread.cpp.
References EQVERB, EQWARN, and eq::base::Lock::set().

| virtual bool eq::base::Thread::init | ( | ) | [inline, virtual] |
The init function for the child thread.
The parent thread will not be unlocked before this function has been executed. If the thread initialization fails, that is, this method did return false, the thread will be stopped and the start() method will return false.
| virtual void* eq::base::Thread::run | ( | ) | [pure virtual] |
The entry function for the child thread.
This method should contain the main execution routine for the thread and is called after a successful init().
| void eq::base::Thread::exit | ( | void * | retVal = 0 |
) | [virtual] |
Exit the child thread immediately.
This function does not return. It is only to be called from the child thread. The thread listeners will be notified.
| retVal | the return value of the thread. |
Definition at line 217 of file thread.cpp.
References EQINFO, and isCurrent().

| void eq::base::Thread::cancel | ( | ) |
Cancel (stop) the child thread.
This function is not to be called from the child thread.
Definition at line 233 of file thread.cpp.
References EQINFO, and isCurrent().

| bool eq::base::Thread::join | ( | void ** | retVal = 0 |
) |
Wait for the exit of the child thread.
| retVal | output value for the return value of the child, can be 0. |
true if the thread was joined, false otherwise. Definition at line 244 of file thread.cpp.
References EQVERB, EQWARN, and isCurrent().

| bool eq::base::Thread::isStopped | ( | ) | const [inline] |
| bool eq::base::Thread::isRunning | ( | ) | const [inline] |
| bool eq::base::Thread::isCurrent | ( | ) | const |
Returns if this thread object is the current (calling) thread.
true if the current thread has is the same thread as this thread, false if not. Definition at line 270 of file thread.cpp.
Referenced by cancel(), exit(), and join().

| void eq::base::Thread::addListener | ( | ExecutionListener * | listener | ) | [static] |
Add a new thread state listener.
| listener | the listener. |
Definition at line 284 of file thread.cpp.
| bool eq::base::Thread::removeListener | ( | ExecutionListener * | listener | ) | [static] |
Remove a thread state listener.
| listener | the listener. |
Definition at line 290 of file thread.cpp.
| void eq::base::Thread::removeAllListeners | ( | ) | [static] |
Remove all registered listeners, used at exit.
Definition at line 304 of file thread.cpp.
References EQINFO.
Referenced by eq::base::exit().

| size_t eq::base::Thread::getSelfThreadID | ( | ) | [static] |
| void eq::base::Thread::pinCurrentThread | ( | ) | [static] |
For internal use only.
Definition at line 324 of file thread.cpp.
References EQINFO, and EQWARN.
Referenced by eq::base::init().

| void _notifyStopping | ( | void * | arg | ) | [friend] |
For internal use only.
| std::ostream& operator<< | ( | std::ostream & | os, | |
| const Thread * | ||||
| ) | [friend] |
0.9 by
1.5.8