Partager via


IWorkerThreadClient::CloseHandle

Implement this method to close the handle associated with this object.

HRESULT CloseHandle(
   HANDLE hHandle 
);

Parameters

  • hHandle
    The handle to be closed.

Return Value

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

Remarks

The handle passed to this method was previously associated with this object by a call to CWorkerThread::AddHandle.

Example

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

HRESULT CloseHandle(HANDLE hObject)
{
   // Users should do any shutdown operation required here.
   // Generally, this means just closing the handle.

   if (!::CloseHandle(hObject))
   {
      // Closing the handle failed for some reason.
      return AtlHresultFromLastError();
   }

   return S_OK;
}

Requirements

Header: atlutil.h

See Also

Reference

IWorkerThreadClient Interface

CWorkerThread::AddHandle

Other Resources

IWorkerThreadClient Members