ZeusBase-Library
2.0.4
|
#include <Thread.h>
Public Types | |
enum | EPriority { etNormal = 0, etLow = 1, etHigh = 2, etLower = 3, etHigher = 4, etTimeCritical = 5 } |
Public Member Functions | |
TThread (EPriority ePriority=etNormal) | |
TThread (IRunnable &rObj, EPriority ePriority=etNormal) | |
EPriority | getPriority () const |
void | setPriority (EPriority ePriority) |
virtual void | kill (Float64 dTimeOut=0) |
virtual bool | isAlive () const |
virtual bool | isDead () const |
virtual void | resume () |
virtual bool | signalizeStop (Float64 dTimeOut=5.0) |
virtual bool | start () |
virtual void | suspend () |
virtual bool | yield () |
virtual Retval | postObject (ISynchronizeObject &rObject, bool bWaitForCompletion) |
virtual bool MQUALIFIER | isInterrupted () const |
virtual Uint MQUALIFIER | getThreadID () const |
virtual Retval MQUALIFIER | askForInterface (const InterfaceID &rInterfaceID, IZUnknown *&rpIface) |
virtual void MQUALIFIER | addRef () const |
virtual void MQUALIFIER | release () const |
Public Member Functions inherited from zeus::TZObject | |
TZObject () | |
TZObject (const TString &strName) | |
TZObject (const IString &strName) | |
Uint | getHash () const |
TString | toString () const |
virtual TString | getObjName () const |
virtual void | setObjName (const TString &name) |
Static Public Member Functions | |
static void | sleep (const Float &rfDelay) |
Protected Member Functions | |
virtual | ~TThread () |
virtual void | execute () |
virtual void | onTerminated () |
virtual void | onStarted () |
Protected Member Functions inherited from zeus::TZObject | |
virtual | ~TZObject () |
TZObject (const TZObject &rObject) | |
TZObject & | operator= (const TZObject &rObject) |
Int | getRefCounter () const |
Protected Attributes | |
bool | m_bInterrupted |
Flag to check if the thread should terminate. More... | |
TThreadMessageQueue & | m_rQueue |
Message queue of the thread. More... | |
Protected Attributes inherited from zeus::TZObject | |
Uint | m_uiID |
This class wrapps a kernel thread object. It provides a simple and convinient interface to the API functions using object oriented design. Lots of tricky code is wrapped to avoid deadlocks and other nasty behaviours just using API functions.
Creates a thread
ePriority | : Thread priority |
Creates a thread using an external object as executing
rObj | : Object for execution |
ePriority | : Thread priority |
|
protectedvirtual |
Destroys the thread
|
virtual |
|
virtual |
Reimplemented from zeus::TZObject.
Reimplemented in zeus::TPeerFinder.
|
protectedvirtual |
This is the internal running method. Do not call this method directly
Reimplemented in zeus::TAbstractSkel::TClientHandlerThread, zeus::TAbstractSkel, zeus::TPeerFinder, and zeus::TPeerProvider.
|
inline |
returns the priority of the thread
|
virtual |
Implements zeus::IThread.
|
inlinevirtual |
Inverse of isDead
|
inlinevirtual |
Checks if the thread is dead. The thread is dead if never start() has been called or after its termination using signalizeStop() or kill().
true | : Thread is not running |
false | : Thread still runs |
|
inlinevirtual |
Implements zeus::IThread.
|
virtual |
Terminates the thread. If time out is not zero, this method will wait, until the thread terminats itself. If timeout occures, the thread will be forced to terminate. This might cause ressource leaks.
dTimeOut | : Time out |
Reimplemented in zeus::TAbstractSkel::TClientHandlerThread, and zeus::TAbstractSkel.
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
virtual |
this sends a message to the queue of the thread
|
virtual |
|
virtual |
This starts a stopped thread.
void TThread::setPriority | ( | EPriority | ePriority | ) |
sets a new priority of the thread
ePriority | : new priority |
|
virtual |
Sets the interrupped signal.
Reimplemented in zeus::TPeerFinder, and zeus::TPeerProvider.
|
static |
Suspends the thread for a given time in seconds
|
virtual |
Starts the thread.
true | Thread created and successfully started |
false | Could not start the thread (OS error) |
|
virtual |
This stopps a thread. Using resume() the thread can be restarted
|
virtual |
this method causes the OS to switch to an other thread (scheduling).
true | : yield has been performed |
false | could not yield thread |
|
protected |
Flag to check if the thread should terminate.
|
protected |
Message queue of the thread.