CWorkerThread Class
This class creates a worker thread or uses an existing one, waits on one or more kernel object handles, and executes a specified client function when one of the handles is signaled.
template <
class ThreadTraits = DefaultThreadTraits
>
class CWorkerThread
Parameters
- ThreadTraits
The class providing the thread creation function, such as CRTThreadTraits or Win32ThreadTraits.
Remarks
To use CWorkerThread
Create an instance of this class.
Call CWorkerThread::AddHandle with the handle of a kernel object and a pointer to an implementation of IWorkerThreadClient.
– or –
Call CWorkerThread::AddTimer with a pointer to an implementation of IWorkerThreadClient.
Implement IWorkerThreadClient::Execute to take some action when the handle or timer is signaled.
To remove an object from the list of waitable objects, call CWorkerThread::RemoveHandle.
To terminate the thread, call CWorkerThread::Shutdown.
Requirements
Header: atlutil.h
See Also
Concepts
Multithreading: Creating Worker Threads