#include <xvr2/ThreadManager.h>
Definition at line 29 of file ThreadManager.h.
Public Types | |
enum | SchedPolicy { NORMAL, ROUND_ROBIN, FIFO } |
Please use this set of constants to define or stablish a thread execution policy. More... | |
Public Member Functions | |
virtual const char * | getClassName () |
Returns the name of the current class. | |
virtual std::string | toString () |
Static Public Member Functions | |
static void | start (Thread *t) |
Spawns thread t execution. | |
static void | start (Thread &t) |
static void | start (Thread *t, const SchedPolicy pol) |
Spawns a thread object execution. | |
static void | start (Thread &t, const SchedPolicy pol) |
static UInt64 | start (BackgroundFunction &bf, bool waitfor=true) |
Runs a Background function in a dedicated Thread of execution. | |
static bool | isRunning (Thread *t) |
Tells wheter the t is running or not. | |
static Thread * | getCurrentThread () |
Returns the currently running Thread object. | |
static BackgroundFunction * | getCurrentBackgroundFunction () |
Returns the currently running BackgroundFunction object. | |
static const UInt64 | getCurrentThreadID () |
Obtains the numeric identification of the current threaded task. | |
static unsigned int | activeCount () |
Obtains a count of the currently running concurrent tasks. | |
static UInt64 | numericID (const Thread *t) |
Obtains the numeric of the given Thread object. | |
static UInt64 | numericID (const Thread &t) |
Obtains the numeric of the given Thread object. | |
static void | join (JoinableThread *t) |
Tells the current task to "join" the specified JoinableThread. | |
static void | join (JoinableThread &t) |
Tells the current task to "join" the specified JoinableThread. | |
static void | detach (JoinableThread *t) |
Tells the given thread that no one with expecting it to finish. | |
static void | detach (JoinableThread &t) |
Tells the given thread that no one with expecting it to finish. | |
static Threading::SchedPolicy | getSchedulingPolicy (Thread *t) |
static Threading::SchedPolicy | getSchedulingPolicy (Thread &t) |
static void | setSchedulingPolicy (Thread *t, Threading::SchedPolicy pol) |
static void | setSchedulingPolicy (Thread &t, Threading::SchedPolicy pol) |
static void | setSchedulingParams (Thread *t, Threading::SchedPolicy pol, int prio) |
static void | setSchedulingParams (Thread &t, Threading::SchedPolicy pol, int prio) |
static void | setPriority (Thread *t, int prio) |
static void | setPriority (Thread &t, int prio) |
static bool | currentIsThread () |
Tells if the current thread has been subclassed from the Thread class. | |
static bool | currentIsBackgroundFunction () |
Tells if the current thread has been subclassed from the BackgroundFunction class. | |
static bool | currentIsMain () |
Tells if the current thread is the main thread, that is the main() function. | |
static void | testCancellation () |
Performs a test to see if the current thread has been asked to be cancelled. | |
static void | debugmsg (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__) |
Will print a debug message to the screen. | |
static void | debugmsgln (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__) |
Protected Attributes | |
std::string | __cls_name |
Friends | |
std::ostream & | operator<< (std::ostream &stream, const Object &s) |
enum xvr2::Threading::SchedPolicy [inherited] |
Please use this set of constants to define or stablish a thread execution policy.
NORMAL | Default scheduling policy, non-realtime. |
ROUND_ROBIN | Round Robin based realtime scheduling policy. |
FIFO | First In First Out based realtime scheduling policy. |
Definition at line 30 of file Threading.h.
static void xvr2::ThreadManager::start | ( | Thread * | t | ) | [static] |
static void xvr2::ThreadManager::start | ( | Thread & | t | ) | [static] |
static void xvr2::ThreadManager::start | ( | Thread * | t, | |
const SchedPolicy | pol | |||
) | [static] |
static void xvr2::ThreadManager::start | ( | Thread & | t, | |
const SchedPolicy | pol | |||
) | [static] |
static UInt64 xvr2::ThreadManager::start | ( | BackgroundFunction & | bf, | |
bool | waitfor = true | |||
) | [static] |
Runs a Background function in a dedicated Thread of execution.
bf | The BackgroundFunction to be runned. | |
waitfor | If true the start method wont return until the thread has been succesfully started. |
static bool xvr2::ThreadManager::isRunning | ( | Thread * | t | ) | [static] |
Tells wheter the t is running or not.
t | The thread to be verified. |
static Thread* xvr2::ThreadManager::getCurrentThread | ( | ) | [static] |
static BackgroundFunction* xvr2::ThreadManager::getCurrentBackgroundFunction | ( | ) | [static] |
Returns the currently running BackgroundFunction object.
static const UInt64 xvr2::ThreadManager::getCurrentThreadID | ( | ) | [static] |
Obtains the numeric identification of the current threaded task.
static unsigned int xvr2::ThreadManager::activeCount | ( | ) | [static] |
Obtains a count of the currently running concurrent tasks.
static void xvr2::ThreadManager::join | ( | JoinableThread * | t | ) | [static] |
Tells the current task to "join" the specified JoinableThread.
Joining is a thread operation in which the current thread is blocked until another thread finishes.
t | The JoinableThread object, which is the thread we will be expecting to finish in order to continue. |
static void xvr2::ThreadManager::join | ( | JoinableThread & | t | ) | [static] |
Tells the current task to "join" the specified JoinableThread.
Joining is a thread operation in which the current thread is blocked until another thread finishes.
t | The JoinableThread object, which is the thread we will be expecting to finish in order to continue. |
static void xvr2::ThreadManager::detach | ( | JoinableThread * | t | ) | [static] |
Tells the given thread that no one with expecting it to finish.
This method will change the thread's execution to a detached state, that is, inmediately after the thread finishes, release all allocated resources from memory since nobody will ever care to joining it.
t | The thread we want to have running in a detached state. |
static void xvr2::ThreadManager::detach | ( | JoinableThread & | t | ) | [static] |
Tells the given thread that no one with expecting it to finish.
This method will change the thread's execution to a detached state, that is, inmediately after the thread finishes, release all allocated resources from memory since nobody will ever care to joining it.
t | The thread we want to have running in a detached state. |
static Threading::SchedPolicy xvr2::ThreadManager::getSchedulingPolicy | ( | Thread * | t | ) | [static] |
static Threading::SchedPolicy xvr2::ThreadManager::getSchedulingPolicy | ( | Thread & | t | ) | [static] |
static void xvr2::ThreadManager::setSchedulingPolicy | ( | Thread * | t, | |
Threading::SchedPolicy | pol | |||
) | [static] |
static void xvr2::ThreadManager::setSchedulingPolicy | ( | Thread & | t, | |
Threading::SchedPolicy | pol | |||
) | [static] |
static void xvr2::ThreadManager::setSchedulingParams | ( | Thread * | t, | |
Threading::SchedPolicy | pol, | |||
int | prio | |||
) | [static] |
static void xvr2::ThreadManager::setSchedulingParams | ( | Thread & | t, | |
Threading::SchedPolicy | pol, | |||
int | prio | |||
) | [static] |
static void xvr2::ThreadManager::setPriority | ( | Thread * | t, | |
int | prio | |||
) | [static] |
static void xvr2::ThreadManager::setPriority | ( | Thread & | t, | |
int | prio | |||
) | [static] |
static bool xvr2::ThreadManager::currentIsThread | ( | ) | [static] |
Tells if the current thread has been subclassed from the Thread class.
static bool xvr2::ThreadManager::currentIsBackgroundFunction | ( | ) | [static] |
Tells if the current thread has been subclassed from the BackgroundFunction class.
static bool xvr2::ThreadManager::currentIsMain | ( | ) | [static] |
Tells if the current thread is the main thread, that is the main() function.
static void xvr2::ThreadManager::testCancellation | ( | ) | [static] |
Performs a test to see if the current thread has been asked to be cancelled.
When this event occurs no finalization callbacks will by run, not even the onTerminate() handler, only the cancellation callbacks will be run, so you must use these in order to perform any required housekeeping for your threads.
virtual const char* xvr2::Object::getClassName | ( | ) | [virtual, inherited] |
Returns the name of the current class.
static void xvr2::Object::debugmsg | ( | Object * | obj, | |
const char * | msg, | |||
int | linenumber = __LINE__ , |
|||
const char * | srcfile = __FILE__ | |||
) | [static, inherited] |
Will print a debug message to the screen.
static void xvr2::Object::debugmsgln | ( | Object * | obj, | |
const char * | msg, | |||
int | linenumber = __LINE__ , |
|||
const char * | srcfile = __FILE__ | |||
) | [static, inherited] |
virtual std::string xvr2::Object::toString | ( | ) | [virtual, inherited] |
std::ostream& operator<< | ( | std::ostream & | stream, | |
const Object & | s | |||
) | [friend, inherited] |
std::string xvr2::Object::__cls_name [protected, inherited] |