#include <Thread.h>
Public Types | |
enum | CancelType { deferred, asynchronous, disable } |
Public Member Functions | |
Thread () | |
constructor | |
virtual | ~Thread () |
destructor | |
void | nice (int x) |
Sets the nice value of the thread process. | |
void | test_cancel () |
test if the thread has been cancelled | |
void | set_cancel (CancelType) |
sets the way the thread can be cancelled. | |
void | exit (int v=0) |
exits the thread | |
virtual void | start () |
Starts the thread. | |
virtual void | stop () |
Stops the thread. | |
virtual void | run ()=0 |
The method that gets executed in the thread. | |
bool | is_running () |
Checks if the thread is running. | |
bool | is_stopped () |
Checks if the thread has stopped. | |
Static Public Member Functions | |
static void * | _run (void *) |
Internal. | |
Private Attributes | |
pthread_t | _thread |
The thread we are wrapping. | |
bool | _started |
says if the thread has already started | |
bool | _stopped |
says if the thread has stopped | |
int | _nice |
The nice value for the trhead process. |
This class represents a thread. It is an abstract class and the objects deriving from it should implement the run() method, which defines what the thread will execute. The thread will start running when the start() method is called and can be stopped by calling the stop() method.
void Thread::set_cancel | ( | CancelType | ct | ) |
sets the way the thread can be cancelled.
It is any of the options in CancelType