ISynchronize::Wait method (objidl.h)

Waits for the synchronization object to be signaled or for a specified timeout period to elapse, whichever comes first.

Syntax

HRESULT Wait(
  [in] DWORD dwFlags,
  [in] DWORD dwMilliseconds
);

Parameters

[in] dwFlags

The wait options. Possible values are taken from the COWAIT_FLAGS enumeration.

[in] dwMilliseconds

The time this call will wait before returning, in milliseconds. If this parameter is INFINITE, the caller will wait until the synchronization object is signaled, no matter how long it takes. If this parameter is 0, the method returns immediately.

Return value

This method can return the standard return values E_INVALIDARG, E_OUTOFMEMORY, and E_FAIL, as well as the following values.

Return code Description
S_OK
The synchronization object was signaled.
RPC_S_CALLPENDING
The time-out period elapsed before the synchronization object was signaled.
RPC_E_NO_SYNC
There is no synchronization object to wait on.

Remarks

If the caller is waiting in a single-thread apartment, Wait enters the COM modal loop. If the caller is waiting in a multithread apartment, the caller is blocked until Wait returns.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header objidl.h (include ObjIdl.h)

See also

CoWaitForMultipleHandles

ISynchronize