C++ common classes
General purpose classes for use across projects (Apache license)
CXPlatPooledThread Class Reference

#include <CXPlatPooledThread.h>

Inheritance diagram for CXPlatPooledThread:
CXPlatThread

List of all members.

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

CXPlatThreadPoolpPoolParent
CXPlatEvent cStartWorking
 Pool that we belong to.
BOOL bThreadBusy
 When set, work starts.
BOOL bTerminateThread
BOOL bThreadAllocated
voidpFuncParam
unsigned long lWaitForCompletion

Friends

class CXPlatThreadPool
 So it can set the bThreadAllocated flag.

Detailed Description

Definition at line 55 of file CXPlatPooledThread.h.


Constructor & Destructor Documentation

Definition at line 62 of file CXPlatPooledThread.cpp.


Member Function Documentation

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.

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.


Friends And Related Function Documentation

friend class CXPlatThreadPool [friend]

So it can set the bThreadAllocated flag.

Definition at line 57 of file CXPlatPooledThread.h.


Member Data Documentation

Definition at line 85 of file CXPlatPooledThread.h.

Definition at line 86 of file CXPlatPooledThread.h.

When set, work starts.

Definition at line 84 of file CXPlatPooledThread.h.

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.

Definition at line 87 of file CXPlatPooledThread.h.

Definition at line 82 of file CXPlatPooledThread.h.


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