UnregisterWait function (winbase.h)

Cancels a registered wait operation issued by the RegisterWaitForSingleObject function.

To use a completion event, call the UnregisterWaitEx function.


BOOL UnregisterWait(
  [in] HANDLE WaitHandle


[in] WaitHandle

The wait handle. This handle is returned by the RegisterWaitForSingleObject function.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.


If any callback functions associated with the timer have not completed when UnregisterWait is called, UnregisterWait unregisters the wait on the callback functions and fails with the ERROR_IO_PENDING error code. The error code does not indicate that the function has failed, and the function does not need to be called again. If your code requires an error code to set only when the unregister operation has failed, call UnregisterWaitEx instead.

To compile an application that uses this function, define _WIN32_WINNT as 0x0500 or later. For more information, see Using the Windows Headers.


Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header winbase.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also


Synchronization Functions

Thread Pooling