Worker Archetype
Classes that conform to the worker archetype provide the code to process work items queued on a thread pool.
Implementation
To implement a class conforming to this archetype, the class must provide the following features:
Method |
Description |
---|---|
Called to initialize the worker object before any requests are passed to Execute. |
|
Called to process a work item. |
|
Called to uninitialize the worker object after all requests have been passed to Execute. |
Typedef |
Description |
---|---|
A typedef for the type of work item that can be processed by the worker class. |
A typical worker class looks like this:
class CMyWorker
{
public:
typedef MyRequestType RequestType;
BOOL Initialize(void* pvWorkerParam);
void Execute(MyRequestType request, void* pvWorkerParam, OVERLAPPED* pOverlapped);
void Terminate(void* pvWorkerParam);
};
Existing Implementations
These classes conform to this archetype:
Class |
Description |
---|---|
Receives requests from the thread pool and passes them on to a worker object that is created and destroyed for each request. |
Use
These template parameters expect the class to conform to this archetype:
Parameter name |
Used by |
---|---|
Worker |
|
Worker |
Requirements
Header: atlutil.h