Platform-independent threading. More...
#include <Radiant/Thread.hpp>
Public Types | |
| typedef void * | id_t |
| Thread id type. More... | |
Public Member Functions | |
| bool | isRunning () const |
| Check if the thread is running. More... | |
| void | run () |
| Starts the thread. | |
| void | setName (const QString &name) |
| Set the thread name. More... | |
| Thread (const QString &name="Radiant::Thread") | |
| Construct a thread structure. More... | |
| bool | waitEnd (int timeoutms=0) |
| Waits until thread is finished. More... | |
| virtual | ~Thread () |
| Destructor. More... | |
Static Public Member Functions | |
| static id_t | myThreadId () |
| The id of the calling thread. More... | |
Protected Member Functions | |
| virtual void | childLoop ()=0 |
| The actual contents of the thread. More... | |
Platform-independent threading.
This class is used by inheriting it and overriding the virtual method childLoop().
| typedef void* Radiant::Thread::id_t |
Thread id type.
On most systems this is some kind of integer value.
| Radiant::Thread::Thread | ( | const QString & | name = "Radiant::Thread" | ) |
Construct a thread structure.
The thread is NOT activated by this method.
| name | thread name |
|
virtual |
Destructor.
The thread must be stopped before this method is
called. Thread cannot be terminated within the destructor, as the inheriting class that implements the virtual childLoop function does not exist any more (its destructor is called before this function).
|
protectedpure virtual |
The actual contents of the thread.
You need to override this to add functionality to your software
| bool Radiant::Thread::isRunning | ( | ) | const |
Check if the thread is running.
|
static |
The id of the calling thread.
| void Radiant::Thread::setName | ( | const QString & | name | ) |
Set the thread name.
The thread name can be used by some debuggers, for example QtCreator. Useful for debugging purposes. Does not affect any functionality.
| name | thread name |
| bool Radiant::Thread::waitEnd | ( | int | timeoutms = 0 | ) |
Waits until thread is finished.
This method does nothing to kill the thread, it simply waits until the thread has run its course.
| timeoutms | How many milliseconds this function call will block at most |