다음을 통해 공유


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

Concepts

CWorkerThread Members

DefaultThreadTraits

ATL Classes

Multithreading: Creating Worker Threads

IWorkerThreadClient Interface