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.
Important
|
|---|
|
This class and its members cannot be used in applications that execute in the Windows Runtime. |
template < class ThreadTraits= DefaultThreadTraits > class CWorkerThread
|
Name |
Description |
|---|---|
|
Call this method to add a waitable object's handle to the list maintained by the worker thread. |
|
|
Call this method to add a periodic waitable timer to the list maintained by the worker thread. |
|
|
Call this method to get the thread handle of the worker thread. |
|
|
Call this method to get the thread ID of the worker thread. |
|
|
Call this method to initialize the worker thread. |
|
|
Call this method to remove a handle from the list of waitable objects. |
|
|
Call this method to shut down the worker thread. |
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.
Important