![]() |
MDSTk Libraries
1.1.0
Medical Data Segmentation Toolkit
|
Encapsulation of several thread functions into a class mds::CThread. More...
#include <mdsThread.h>

Public Types | |
| enum | { CLASS_OBJECT } |
| Templates that require members of the CObject class can use this enum to check the existence. More... | |
| enum | { HEAP_OBJECT = 0x70616568 } |
| Signature used to recognize objects on the heap. More... | |
| typedef int( | tRoutine )(CThread *pThread) |
| User thread routine. | |
| typedef tRoutine * | tRoutinePtr |
| Pointer to a user thread routine. | |
Public Member Functions | |
| CThread (tRoutinePtr pRoutine, void *pData=NULL, bool bRun=true) | |
| Constructor. | |
| void * | getData () |
| Returns pointer to the user data. | |
| int | getExitCode () |
| Returns exit code returned by an user thread routine. | |
| int | getReferencesCount () const |
| Returns the number of references. | |
| bool | isActive () |
| Returns true if the thread is running. | |
| bool | isExitSignalled () |
| Returns true if the exit event is already signalled. | |
| bool | isOnHeap () const |
| Returns true if the object is allocated on the heap. | |
| bool | join (unsigned uTimeout) |
| Waits for the thread termination. | |
| MDS_SHAREDPTR (CThread) | |
| Smart pointer type. | |
| void | resume () |
| Resumes the suspended thread. | |
| void | setData (void *pData) |
| Sets pointer to the user data. | |
| void | setExitEvent () |
| Signals the exit event that controls the thread termination. | |
| void | setPriority (EThreadPriority ePriority) |
| Sets the thread priority. | |
| void | suspend () |
| Suspends the thread. | |
| void | terminate (bool bWait=true, unsigned uTime=THREAD_EXIT_TIME) |
| Terminates the thread. | |
| virtual | ~CThread () |
| Destructor. | |
Static Public Member Functions | |
| static void * | operator new (std::size_t Size) |
| Allocates a new object on the heap. | |
Protected Member Functions | |
| void | addReference () const |
| Increase the reference counter. | |
| bool | delReference () const |
| Decrease the reference counter. | |
Protected Attributes | |
| bool | m_bSuspended |
| Thread suspended flag. | |
| CCriticalSection | m_CritSec |
| Critical section for mutual access. | |
| CEvent | m_ExitEvent |
| Event the thread should check periodically and exit when it's set. | |
| int | m_iExitCode |
| Thread exit code. | |
| int | m_iHeapObject |
| Flag initialized if the object is on the heap. | |
| int | m_iReferences |
| The number of references to the object. | |
| CEvent | m_NotSuspendedEvent |
| Event signalled if the thread is not paused. | |
| void * | m_pData |
| Pointer to user data. | |
| tRoutinePtr | m_pRoutine |
| Pointer to a user thread routine. | |
| CEvent | m_TerminatedEvent |
| Event signalled when the thread has terminated. | |
Encapsulation of several thread functions into a class mds::CThread.
| typedef int( mds::sys::CThread::tRoutine)(CThread *pThread) |
User thread routine.
| typedef tRoutine* mds::sys::CThread::tRoutinePtr |
Pointer to a user thread routine.
anonymous enum [inherited] |
Templates that require members of the CObject class can use this enum to check the existence.
| mds::sys::CThread::CThread | ( | tRoutinePtr | pRoutine, |
| void * | pData = NULL, |
||
| bool | bRun = true |
||
| ) |
Constructor.
| virtual mds::sys::CThread::~CThread | ( | ) | [virtual] |
Destructor.
| void mds::base::CObject::addReference | ( | ) | const [protected, inherited] |
Increase the reference counter.
| bool mds::base::CObject::delReference | ( | ) | const [protected, inherited] |
Decrease the reference counter.
| void* mds::sys::CThread::getData | ( | ) |
Returns pointer to the user data.
Returns exit code returned by an user thread routine.
| int mds::base::CObject::getReferencesCount | ( | ) | const [inherited] |
Returns the number of references.
| bool mds::sys::CThread::isActive | ( | ) |
Returns true if the thread is running.
| bool mds::sys::CThread::isExitSignalled | ( | ) |
Returns true if the exit event is already signalled.
| bool mds::base::CObject::isOnHeap | ( | ) | const [inherited] |
Returns true if the object is allocated on the heap.
| bool mds::sys::CThread::join | ( | unsigned | uTimeout | ) |
Waits for the thread termination.
Smart pointer type.
| static void* mds::base::CObject::operator new | ( | std::size_t | Size | ) | [static, inherited] |
Allocates a new object on the heap.
| void mds::sys::CThread::resume | ( | ) |
Resumes the suspended thread.
| void mds::sys::CThread::setData | ( | void * | pData | ) |
Sets pointer to the user data.
| void mds::sys::CThread::setExitEvent | ( | ) |
Signals the exit event that controls the thread termination.
| void mds::sys::CThread::setPriority | ( | EThreadPriority | ePriority | ) |
Sets the thread priority.
| void mds::sys::CThread::suspend | ( | ) |
Suspends the thread.
| void mds::sys::CThread::terminate | ( | bool | bWait = true, |
| unsigned | uTime = THREAD_EXIT_TIME |
||
| ) |
Terminates the thread.
bool mds::sys::CThread::m_bSuspended [protected] |
Thread suspended flag.
CCriticalSection mds::sys::CThread::m_CritSec [protected] |
Critical section for mutual access.
CEvent mds::sys::CThread::m_ExitEvent [protected] |
Event the thread should check periodically and exit when it's set.
int mds::sys::CThread::m_iExitCode [protected] |
Thread exit code.
int mds::base::CObject::m_iHeapObject [mutable, protected, inherited] |
Flag initialized if the object is on the heap.
int mds::base::CObject::m_iReferences [mutable, protected, inherited] |
The number of references to the object.
CEvent mds::sys::CThread::m_NotSuspendedEvent [protected] |
Event signalled if the thread is not paused.
void* mds::sys::CThread::m_pData [protected] |
Pointer to user data.
tRoutinePtr mds::sys::CThread::m_pRoutine [protected] |
Pointer to a user thread routine.
CEvent mds::sys::CThread::m_TerminatedEvent [protected] |
Event signalled when the thread has terminated.
1.7.6.1