Partager via


CWorkerThread::AddTimer

Call this method to add a periodic waitable timer to the list maintained by the worker thread.

HRESULT AddTimer(
   DWORD dwInterval,
   IWorkerThreadClient* pClient,
   DWORD_PTR dwParam,
   HANDLE* phTimer
) throw( );

Parameters

  • dwInterval
    Specifies the period of the timer in milliseconds.

  • pClient
    The pointer to the IWorkerThreadClient interface on the object to be called when the handle is signaled.

  • dwParam
    The parameter to be passed to IWorkerThreadClient::Execute when the handle is signaled.

  • phTimer
    [out] Address of the HANDLE variable that, on success, receives the handle to the newly created timer.

Return Value

Returns S_OK on success, or an error HRESULT on failure.

Remarks

IWorkerThreadClient::Execute will be called through pClient when the timer is signaled.

Pass the timer handle from phTimer to CWorkerThread::RemoveHandle to close the timer.

Requirements

Header: atlutil.h

See Also

Concepts

CWorkerThread Class

CWorkerThread Members