ICancelMethodCalls::SetCancelTimeout

[This is preliminary documentation and subject to change.]

Sets the lower bound on the time COM waits for a server to acknowledge a cancel request.

HRESULT SetCancelTimeout(
  int nSeconds  //Timeout period
);
 

Parameters

nSeconds
[in] Number of seconds COM waits for a server to acknowledge a cancel request. If 0, a call to Cancel returns immediately without waiting for an acknowledgment. If RPC_C_CANCEL_INFINITE_TIMEOUT, a call to Cancel waits indefinitely for acknowledgment.

Return Values

This method supports the standard return values E_FAIL, E_NOTIMPL, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following:

S_OK
The timeout period was set.

Remarks

The client must call SetCancelTimeout before making the method call associated with the cancel object. Unless the timeout period is specified as 0, the value passed is only advisory: how the cancel object uses it depends on the implementation and can take into account such factors as the context of the call (in-process, out-of-process on local machine, out-of-process on remote machine) and nature of client thread (apartment or free thread).

A timeout value of 0 must always be honored, in which case the caller never waits for an acknowledgment and so is never blocked by a pending call to Cancel. For a timeout value of 0, a subsequent call to TestCancel must return RPC_E_CALL_CANCELED if the call is actually canceled.

If the timeout value is 0 and the pending call returns, COM discards the return value of the pending call.

A timeout value of RPC_C_CANCEL_INFINITE_TIMEOUT indicates that the caller will wait until the Cancel call returns, no matter how long it takes. For a timeout value of RPC_C_CANCEL_INFINITE_TIMEOUT, a subsequent call to TestCancel must return RPC_E_CALL_CANCELED if the call is actually canceled.

QuickInfo

  Windows NT: Use version 5.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in objidl.h.