The C++ framework for developing highly scalable, high performance servers on Windows platforms.

IThreadPoolWorkerThreadCallback Class Reference
[Win32 Threading primitivesInterfacesProtected destructors on abstract base classes]

Inheritance diagram for IThreadPoolWorkerThreadCallback:

List of all members.


Detailed Description

An interface to an object that acts as a worker thread for a work queue. The life-cycle of an object that implements this interface is as follows: one call to Initialise() (and, if it returns true), 0 or many calls to Process() and then one call to Shutdown().

Public Member Functions

virtual bool Initialise ()=0
 Called once when the thread is first started. The thread should perform any required initialisation and return true if it was able to initialise correctly and false if it has failed to initialise and should be shut down.
virtual bool ProcessEx (const ULONG_PTR completionKey, const DWORD numberOfBytes, IAsyncWorkItem *pWorkItem)
 Called when a work item needs to be processed by the thread. Can indicate that you want to have NoItemsToProcess() called once each time the queue becomes empty by returning 'true'.
virtual void Process (ULONG_PTR completionKey, DWORD numberOfBytes, IAsyncWorkItem *pWorkItem)=0
 Called when a work item needs to be processed by the thread.
virtual bool NoItemsToProcess ()
 Called once when the queue becomes empty if the last call to ProcessEx() or NoItemsToprocess() returned 'true'.
virtual void Shutdown ()=0
 Called when the thread is being shut down the thread can perform any required clean up tasks here.
virtual void OnProcessException (const _tstring &message)=0
 Called if an exception leaks from Process.
virtual void OnThreadTerminationException (const _tstring &message)=0
 Called if a thread is terminated due to an exception.

Protected Member Functions

virtual ~IThreadPoolWorkerThreadCallback ()
 We never delete instances of this interface; you must manage the lifetime of the class that implements it.

Constructor & Destructor Documentation

virtual ~IThreadPoolWorkerThreadCallback (  )  [protected, virtual]

We never delete instances of this interface; you must manage the lifetime of the class that implements it.


Member Function Documentation

virtual bool Initialise (  )  [pure virtual]

Called once when the thread is first started. The thread should perform any required initialisation and return true if it was able to initialise correctly and false if it has failed to initialise and should be shut down.

virtual bool ProcessEx ( const ULONG_PTR  completionKey,
const DWORD  numberOfBytes,
IAsyncWorkItem pWorkItem 
) [inline, virtual]

Called when a work item needs to be processed by the thread. Can indicate that you want to have NoItemsToProcess() called once each time the queue becomes empty by returning 'true'.

virtual void Process ( ULONG_PTR  completionKey,
DWORD  numberOfBytes,
IAsyncWorkItem pWorkItem 
) [pure virtual]

Called when a work item needs to be processed by the thread.

virtual bool NoItemsToProcess (  )  [inline, virtual]

Called once when the queue becomes empty if the last call to ProcessEx() or NoItemsToprocess() returned 'true'.

virtual void Shutdown (  )  [pure virtual]

Called when the thread is being shut down the thread can perform any required clean up tasks here.

virtual void OnProcessException ( const _tstring message  )  [pure virtual]

Called if an exception leaks from Process.

virtual void OnThreadTerminationException ( const _tstring message  )  [pure virtual]

Called if a thread is terminated due to an exception.


Generated on Sun Sep 12 19:08:40 2021 for The Server Framework - v7.4 by doxygen 1.5.3