Public Member Functions

CdcThread Class Reference

A wrapper on an OS threads. More...

#include <DcThread.h>

List of all members.

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.

Detailed Description

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!

Author:
Erez Bibi
Version:
1.0

Definition at line 49 of file DcThread.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

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.

Returns:
(bool) True if thread function is still running.

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.

Parameters:
funcPointer to the main thread function.
pdataPointer to the data to pass to the thread (can be NULL).
priorityThe thread priority of execution. The real priority is depending on the operation system, but on both we will get similar results.
stack_sizeThe new thread stack size in one K units. Default is the creating thread stack size.
Exceptions:
(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.

Parameters:
priorityThe new priority for this thread.
Returns:
(bool) True on success, False if failed.

Definition at line 59 of file DcThread.cpp.


The documentation for this class was generated from the following files: