Public Member Functions

CxUtils::Thread::Manager Class Reference

Thread Manager class which can be used to keep track of multiple running threads. More...

#include <thread.h>

List of all members.

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

Detailed Description

Thread Manager class which can be used to keep track of multiple running threads.

Definition at line 99 of file thread.h.


Constructor & Destructor Documentation

Thread::Manager::Manager (  )

Constructor.

Definition at line 59 of file thread.cpp.

Thread::Manager::~Manager (  )

Destructor.

Definition at line 70 of file thread.cpp.


Member Function Documentation

bool Thread::Manager::CreateThread ( const std::string &  name,
void(*)(void *)  func,
void *  args,
const int  priority = 0 
)

Creates a new thread.

Parameters:
[in]nameName to reference thread by.
[in]funcPointer to function to execute in thread.
[in]argsPointer to arguments to pass to executing function.
[in]priorityThread priority [-50, 50].
Returns:
True on success, otherwise false on failure to create thread.

Definition at line 88 of file thread.cpp.

unsigned int CxUtils::Thread::Manager::GetNumThreads (  ) const [inline]

Definition at line 109 of file thread.h.

bool Thread::Manager::IsThreadActive ( const std::string &  name ) const

Checks to see if a thread is actively running.

Parameters:
[in]nameName of the thread to check status for.
Returns:
True if running, false otherwise (or doesn't exist).

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.

Parameters:
[in]nameName of the thread to check status for.
Returns:
True if thread should exist (StopThread called), false if it should keep running.

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.

Parameters:
[in]nameName to reference thread by.
[in]msNumber of milliseconds to wait for thread to quit.

Definition at line 112 of file thread.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines