Open sandboxFocus

Method ShouldWaitForDisposalInProgress

ShouldWaitForDisposalInProgress()

Determines whether a call to Dispose() or DisposeAsync() waits for the completion of another disposal that is already in progress. This protected method is part of the implementation API and is meant to be overridden in user code, not invoked.

Declaration
protected virtual bool ShouldWaitForDisposalInProgress()
Returns
Type Description
bool

true if the call waits for the disposal in progress, or false if the call returns before the disposal in progress completes. The default implementation returns true.

Remarks

Override this method when the disposal in progress waits for code that can itself call Dispose() or DisposeAsync(), for instance the processing of a message by a background receive loop. When this method is called from such code, return false, because the wait for the disposal in progress would cause a deadlock.