The MThread class implements a multithreading mechanism.
More...
#include <Thread.h>
|
| Thread () |
|
| ~Thread () |
| The destructor calls MThread::Stop to clean up. More...
|
|
virtual bool | Start (int(*thread_func)(void *), const char *name, void *data)=0 |
| Start Starts the function given as argument in this thread. More...
|
|
virtual void | Stop ()=0 |
| Stop Stops this thread. More...
|
|
virtual int | WaitForReturn ()=0 |
| WaitForReturn Waits for thread_func from MThread::Start to return a value. More...
|
|
bool | IsRunning () |
| IsRunning Returns if the thread is currently running. More...
|
|
void | SetRunning (bool value) |
|
virtual int | GetId ()=0 |
| GetId Gets the thread ID from SDL and returns it. More...
|
|
virtual Thread * | getNew ()=0 |
| Creates a new thread object. Should be overwritten by child classes. More...
|
|
The MThread class implements a multithreading mechanism.
- Bug:
- Should this class be here, in MEngine or somewhere else?
- See also
- MSemaphore
-
MSleep
The destructor calls MThread::Stop to clean up.
virtual int Neo::Thread::GetId |
( |
| ) |
|
|
pure virtual |
GetId Gets the thread ID from SDL and returns it.
- Returns
- The thread ID.
virtual Thread* Neo::Thread::getNew |
( |
| ) |
|
|
pure virtual |
Creates a new thread object. Should be overwritten by child classes.
- Returns
bool Neo::Thread::IsRunning |
( |
| ) |
|
|
inline |
IsRunning Returns if the thread is currently running.
- Returns
- Is this thread running?
void Neo::Thread::SetRunning |
( |
bool |
value | ) |
|
|
inline |
virtual bool Neo::Thread::Start |
( |
int(*)(void *) |
thread_func, |
|
|
const char * |
name, |
|
|
void * |
data |
|
) |
| |
|
pure virtual |
Start Starts the function given as argument in this thread.
The data argument will be given to the thread function when the thread starts.
The function has to look like:
- Parameters
-
thread_func | Function that will be executed when thread starts. |
name | The name of the thread. For example 'input' or 'update' |
data | Data that needs to be pushed to the thread function. |
- Returns
- Returns true on success, false on failure.
virtual void Neo::Thread::Stop |
( |
| ) |
|
|
pure virtual |
Stop Stops this thread.
This would force quit the thread on older versions of SDL. In this version (2.x) it only calls MThread::WaitForReturn and cleans up all private variables.
virtual int Neo::Thread::WaitForReturn |
( |
| ) |
|
|
pure virtual |
WaitForReturn Waits for thread_func from MThread::Start to return a value.
- Returns
- The exit value of thread_func.
The documentation for this class was generated from the following file: