Struct Timeout
Helps to compute timeout for asynchronous operations.
Namespace: DotNext.Threading
Assembly: DotNext.dll
Syntax
public struct Timeout
Constructors
| Improve this Doc View SourceTimeout(TimeSpan)
Constructs a new timeout control object.
Declaration
public Timeout(TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeout | Max duration of operation. |
Properties
| Improve this Doc View SourceIsExpired
Indicates that timeout is reached.
Declaration
public bool IsExpired { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
| Improve this Doc View SourceThrowIfExpired()
Throws
Declaration
public void ThrowIfExpired()
ThrowIfExpired(out TimeSpan)
Throws
Declaration
public void ThrowIfExpired(out TimeSpan remaining)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | remaining | The remaining time before timeout. |
Operators
| Improve this Doc View SourceFalse(Timeout)
Indicates that timeout is not reached.
Declaration
public static bool operator false (in Timeout timeout)
Parameters
Type | Name | Description |
---|---|---|
Timeout | timeout | Timeout control object. |
Returns
Type | Description |
---|---|
Boolean | false, if timeout is not reached; otherwise, false. |
Implicit(Timeout to TimeSpan)
Extracts original timeout value from this object.
Declaration
public static implicit operator TimeSpan(in Timeout timeout)
Parameters
Type | Name | Description |
---|---|---|
Timeout | timeout | Timeout control object. |
Returns
Type | Description |
---|---|
TimeSpan | The original timeout value. |
True(Timeout)
Indicates that timeout is reached.
Declaration
public static bool operator true (in Timeout timeout)
Parameters
Type | Name | Description |
---|---|---|
Timeout | timeout | Timeout control object. |
Returns
Type | Description |
---|---|
Boolean | true, if timeout is reached; otherwise, false. |