Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IWorkerThreadClient::Execute

 

Implement this method to execute code when the handle associated with this object becomes signaled.


      HRESULT Execute(
   DWORD_PTR dwParam,
   HANDLE hObject 
);

dwParam

The user parameter.

hObject

The handle that has become signaled.

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

The handle and DWORD/pointer passed to this method were previously associated with this object by a call to CWorkerThread::AddHandle.

Example

The following code shows a simple implementation of IWorkerThreadClient::Execute.

HRESULT Execute(DWORD_PTR dwParam, HANDLE hObject)
{
   // Cast the parameter to its known type.
   LONG* pn = reinterpret_cast<LONG*>(dwParam);

   // Increment the LONG.
   LONG n = InterlockedIncrement(pn);

   // Log the results.
   printf_s("Handle 0x%08X incremented value to : %d\n", (DWORD_PTR)hObject, n);

   return S_OK;
}

Requirements

Header: atlutil.h

Show: