Partager via


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

Remarks

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.

Requirements

Header: atlutil.h

See Also

Reference

DefaultThreadTraits

IWorkerThreadClient Interface

Concepts

Multithreading: Creating Worker Threads

Other Resources

CWorkerThread Members

ATL Classes