AsyncTimeout
Ecng.ComponentModel
Represents an asynchronous timeout for an operation.
Constructors
AsyncTimeout
public AsyncTimeout(TimeSpan value)
asyncTimeout = AsyncTimeout(value)
Initializes a new instance of the AsyncTimeout class with the specified timeout value.
- value
- The timeout duration. Must be greater than Zero.
Properties
Methods
Register
public IDisposable Register(Action action)
result = asyncTimeout.Register(action)
Registers an action to be invoked when the timeout elapses.
- action
- The action to execute on timeout.
Returns: A handle that cancels the pending timeout (so a completed operation can stop it from firing) and releases the underlying CancellationTokenSource when disposed.