Export (0) Print
Expand All

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.

To use CWorkerThread

  1. Create an instance of this class.

  2. Call CWorkerThread::Initialize.

  3. 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.

  4. Implement IWorkerThreadClient::Execute to take some action when the handle or timer is signaled.

  5. To remove an object from the list of waitable objects, call CWorkerThread::RemoveHandle.

  6. To terminate the thread, call CWorkerThread::Shutdown.

Header: atlutil.h

Community Additions

ADD
Show:
© 2014 Microsoft