#include <FXThread.h>
Public Member Functions | |
FXThread () | |
FXThreadID | id () const |
FXbool | running () const |
FXbool | start (unsigned long stacksize=0) |
FXbool | join () |
FXbool | join (FXint &code) |
FXbool | cancel () |
FXbool | detach () |
void | priority (FXint prio) |
FXint | priority () |
virtual | ~FXThread () |
Static Public Member Functions | |
static void | exit (FXint code=0) |
static void | yield () |
static FXlong | time () |
static void | sleep (FXlong nsec) |
static void | wakeat (FXlong nsec) |
static FXThread * | self () |
static FXThreadID | current () |
Protected Member Functions | |
virtual FXint | run ()=0 |
Friends | |
class | QThreadFXThread |
FX::FXThread::FXThread | ( | ) |
Initialize thread object.
virtual FX::FXThread::~FXThread | ( | ) | [virtual] |
Destroy the thread immediately, running or not. It is probably better to wait until it is finished, in case the thread currently holds mutexes.
virtual FXint FX::FXThread::run | ( | ) | [protected, pure virtual] |
All threads execute by deriving the run method of FXThread. If an uncaught exception was thrown, this function returns -1.
FXThreadID FX::FXThread::id | ( | ) | const |
Return handle of this thread object. This handle is valid in the context of the thread which called start().
FXbool FX::FXThread::running | ( | ) | const |
Return TRUE if this thread is running.
FXbool FX::FXThread::start | ( | unsigned long | stacksize = 0 |
) |
Start thread; the thread is started as attached. The thread is given stacksize for its stack; a value of zero for stacksize will give it the default stack size.
FXbool FX::FXThread::join | ( | ) |
Suspend calling thread until thread is done.
FXbool FX::FXThread::join | ( | FXint & | code | ) |
FXbool FX::FXThread::cancel | ( | ) |
Cancel the thread, stopping it immediately, running or not. If the calling thread is this thread, nothing happens. It is probably better to wait until it is finished, in case the thread currently holds mutexes.
FXbool FX::FXThread::detach | ( | ) |
Detach thread, so that a no join() is necessary to harvest the resources of this thread.
static void FX::FXThread::exit | ( | FXint | code = 0 |
) | [static] |
Exit the calling thread. No destructors are invoked for objects on thread's stack; to invoke destructors, throw an exception instead.
static void FX::FXThread::yield | ( | ) | [static] |
Make the thread yield its time quantum.
static FXlong FX::FXThread::time | ( | ) | [static] |
Return time in nanoseconds since Epoch (Jan 1, 1970).
static void FX::FXThread::sleep | ( | FXlong | nsec | ) | [static] |
Make the calling thread sleep for a number of nanoseconds.
static void FX::FXThread::wakeat | ( | FXlong | nsec | ) | [static] |
Wake at appointed time specified in nanoseconds since Epoch.
static FXThread* FX::FXThread::self | ( | ) | [static] |
Return pointer to the FXThread instance associated with the calling thread; it returns NULL for the main thread and all threads not created by FOX.
static FXThreadID FX::FXThread::current | ( | ) | [static] |
Return thread id of calling thread.
void FX::FXThread::priority | ( | FXint | prio | ) |
Set thread priority.
FXint FX::FXThread::priority | ( | ) |
Return thread priority.