C++ common classes
General purpose classes for use across projects (Apache license)
|
#include <CXPlatPooledThread.h>
Public Member Functions | |
CXPlatPooledThread () | |
virtual | ~CXPlatPooledThread () |
virtual int | StartWorking () |
virtual BOOL | IsThreadBusy () |
Is thread in the user's code? | |
void | SetCompletionWaitTime (unsigned long lWaitTime) |
Set the max time we will wait for thread to finish work when we are ready to terminate it. | |
Protected Member Functions | |
unsigned | WorkerFunction (void *pParam) |
virtual unsigned | PooledWorkerFunction ()=0 |
Protected Attributes | |
CXPlatThreadPool * | pPoolParent |
CXPlatEvent | cStartWorking |
Pool that we belong to. | |
BOOL | bThreadBusy |
When set, work starts. | |
BOOL | bTerminateThread |
BOOL | bThreadAllocated |
void * | pFuncParam |
unsigned long | lWaitForCompletion |
Friends | |
class | CXPlatThreadPool |
So it can set the bThreadAllocated flag. |
Definition at line 55 of file CXPlatPooledThread.h.
Definition at line 55 of file CXPlatPooledThread.cpp.
CXPlatPooledThread::~CXPlatPooledThread | ( | ) | [virtual] |
Definition at line 62 of file CXPlatPooledThread.cpp.
BOOL CXPlatPooledThread::IsThreadBusy | ( | ) | [virtual] |
Is thread in the user's code?
Definition at line 81 of file CXPlatPooledThread.cpp.
virtual unsigned CXPlatPooledThread::PooledWorkerFunction | ( | ) | [protected, pure virtual] |
This is what you should derive from to do your work. Note that once PooledWorkerFunction returns, this thread is returned to the thread pool and you must request a new thread for any further work.
void CXPlatPooledThread::SetCompletionWaitTime | ( | unsigned long | lWaitTime | ) |
Set the max time we will wait for thread to finish work when we are ready to terminate it.
Definition at line 117 of file CXPlatPooledThread.cpp.
int CXPlatPooledThread::StartWorking | ( | ) | [virtual] |
Start doing the user's duty. NEVER CALL THIS TWICE! **** After your PooledWorkerFunction returns, this thread is added back to the thread pool!
Definition at line 72 of file CXPlatPooledThread.cpp.
unsigned CXPlatPooledThread::WorkerFunction | ( | void * | pParam | ) | [protected, virtual] |
Implemented by this class. SHOULD NOT BE DERIVED FROM! Use PooledWorkerFunction instead.
Implements CXPlatThread.
Definition at line 89 of file CXPlatPooledThread.cpp.
friend class CXPlatThreadPool [friend] |
So it can set the bThreadAllocated flag.
Definition at line 57 of file CXPlatPooledThread.h.
BOOL CXPlatPooledThread::bTerminateThread [protected] |
Definition at line 85 of file CXPlatPooledThread.h.
BOOL CXPlatPooledThread::bThreadAllocated [protected] |
Definition at line 86 of file CXPlatPooledThread.h.
BOOL CXPlatPooledThread::bThreadBusy [protected] |
When set, work starts.
Definition at line 84 of file CXPlatPooledThread.h.
CXPlatEvent CXPlatPooledThread::cStartWorking [protected] |
Pool that we belong to.
Definition at line 83 of file CXPlatPooledThread.h.
unsigned long CXPlatPooledThread::lWaitForCompletion [protected] |
Definition at line 88 of file CXPlatPooledThread.h.
void* CXPlatPooledThread::pFuncParam [protected] |
Definition at line 87 of file CXPlatPooledThread.h.
CXPlatThreadPool* CXPlatPooledThread::pPoolParent [protected] |
Definition at line 82 of file CXPlatPooledThread.h.