A wrapper on an OS threads. More...
#include <DcThread.h>
Public Member Functions | |
CdcThread () | |
Constructor - just initialize the thread pointer. | |
void | MakeThread (int(*pfunc)(void *), void *pdata, int stack_size=0) throw (CdcException) |
Call this function to start a new thread. | |
void | CloseThread () |
Just close the handle to this thread!!! | |
bool | SetPriority (t_thread_priority priority) |
Function to set the priority of the thread. | |
bool | IsStillActive () |
Returns True if thread is still active. | |
virtual | ~CdcThread () |
Destructor. |
A wrapper on an OS threads.
Note: This class does not terminate the thread in the Destructor, or in any other way. The thread terminates when it's start point function exits. If your main thread function is running in an infinite loop, you have to signal it to exit when you want the thread to terminate!
Definition at line 49 of file DcThread.h.
CdcThread::CdcThread | ( | ) | [inline] |
Constructor - just initialize the thread pointer.
Definition at line 59 of file DcThread.h.
CdcThread::~CdcThread | ( | ) | [virtual] |
Destructor.
Definition at line 27 of file DcThread.cpp.
void CdcThread::CloseThread | ( | ) |
Just close the handle to this thread!!!
Definition at line 52 of file DcThread.cpp.
bool CdcThread::IsStillActive | ( | ) |
Returns True if thread is still active.
Definition at line 84 of file DcThread.cpp.
void CdcThread::MakeThread | ( | int(*)(void *) | pfunc, |
void * | pdata, | ||
int | stack_size = 0 |
||
) | throw (CdcException) |
Call this function to start a new thread.
func | Pointer to the main thread function. |
pdata | Pointer to the data to pass to the thread (can be NULL). |
priority | The thread priority of execution. The real priority is depending on the operation system, but on both we will get similar results. |
stack_size | The new thread stack size in one K units. Default is the creating thread stack size. |
(CdcException) | If cannot start a new thread. |
Definition at line 32 of file DcThread.cpp.
bool CdcThread::SetPriority | ( | t_thread_priority | priority ) |
Function to set the priority of the thread.
priority | The new priority for this thread. |
Definition at line 59 of file DcThread.cpp.