Thread Manager class which can be used to keep track of multiple running threads. More...
#include <thread.h>
Public Member Functions | |
Manager () | |
Constructor. | |
~Manager () | |
Destructor. | |
bool | CreateThread (const std::string &name, void(*func)(void *), void *args, const int priority=0) |
Creates a new thread. | |
void | StopThread (const std::string &name, const int ms=500) |
Stops and deletes a thread. | |
void | StopAllThreads () |
Stops and deletes all threads. | |
bool | IsThreadActive (const std::string &name) const |
Checks to see if a thread is actively running. | |
bool | QuitThreadFlag (const std::string &name) const |
Checks to see if a thread should exit. | |
unsigned int | GetNumThreads () const |
Thread Manager class which can be used to keep track of multiple running threads.
Definition at line 99 of file thread.h.
Thread::Manager::Manager | ( | ) |
Constructor.
Definition at line 59 of file thread.cpp.
Thread::Manager::~Manager | ( | ) |
Destructor.
Definition at line 70 of file thread.cpp.
bool Thread::Manager::CreateThread | ( | const std::string & | name, |
void(*)(void *) | func, | ||
void * | args, | ||
const int | priority = 0 |
||
) |
Creates a new thread.
[in] | name | Name to reference thread by. |
[in] | func | Pointer to function to execute in thread. |
[in] | args | Pointer to arguments to pass to executing function. |
[in] | priority | Thread priority [-50, 50]. |
Definition at line 88 of file thread.cpp.
unsigned int CxUtils::Thread::Manager::GetNumThreads | ( | ) | const [inline] |
bool Thread::Manager::IsThreadActive | ( | const std::string & | name ) | const |
Checks to see if a thread is actively running.
[in] | name | Name of the thread to check status for. |
Definition at line 152 of file thread.cpp.
bool Thread::Manager::QuitThreadFlag | ( | const std::string & | name ) | const |
Checks to see if a thread should exit.
[in] | name | Name of the thread to check status for. |
Definition at line 175 of file thread.cpp.
void Thread::Manager::StopAllThreads | ( | ) |
Stops and deletes all threads.
Definition at line 130 of file thread.cpp.
void Thread::Manager::StopThread | ( | const std::string & | name, |
const int | ms = 500 |
||
) |
Stops and deletes a thread.
[in] | name | Name to reference thread by. |
[in] | ms | Number of milliseconds to wait for thread to quit. |
Definition at line 112 of file thread.cpp.