Regina Calculation Engine
|
Provides very basic thread handling. More...
#include <utilities/nthread.h>
Public Member Functions | |
virtual | ~NThread () |
Destroys this thread. | |
bool | start (void *args=0, bool deleteAfterwards=false) |
Starts a new thread that performs the run() routine. | |
virtual void * | run (void *args)=0 |
The routine to run in the new thread when start(void*) is called. | |
Static Public Member Functions | |
static bool | start (void *(*routine)(void *), void *args, NThreadID *id) |
Starts a new thread that performs the given routine. | |
static void | yield () |
Causes the currently running thread to voluntarily relinquish the processor. |
Provides very basic thread handling.
Each subclass of NThread represents a specific task that new threads should perform.
A subclass should override run() so that it performs whatever task is required of each new thread. Then start() may be called whenever a new thread is required.
regina::NThread::~NThread | ( | ) | [inline, virtual] |
Destroys this thread.
virtual void* regina::NThread::run | ( | void * | args | ) | [pure virtual] |
The routine to run in the new thread when start(void*) is called.
args | the argument passed to start(void*). |
Implemented in regina::NFacePairing.
static bool regina::NThread::start | ( | void *(*)(void *) | routine, |
void * | args, | ||
NThreadID * | id | ||
) | [static] |
Starts a new thread that performs the given routine.
The return value of the given routine is currently ignored.
routine | the routine to run in the new thread. |
args | the arguments to pass to routine when it is started. |
id | a location in which the ID of the new thread will be placed, or 0 if the new thread ID is not required. If non-zero, this parameter must point to an already extisting NThreadID that may contain any value. |
true
if and only if the new thread was successfully started. bool regina::NThread::start | ( | void * | args = 0 , |
bool | deleteAfterwards = false |
||
) |
Starts a new thread that performs the run() routine.
The return value of run() is currently ignored.
args | the arguments to pass to run() when it is started. |
deleteAfterwards | true if this NThread object should be deleted once run() has finished. |
true
if and only if the new thread was successfully started. void regina::NThread::yield | ( | ) | [inline, static] |
Causes the currently running thread to voluntarily relinquish the processor.
Another thread of equal or higher priority will be given a turn instead.