Class LinkedTokenSourceFactory
Represents helper methods for working with linked cancellation tokens.
Inherited Members
Namespace: DotNext.Threading
Assembly: DotNext.Threading.dll
Syntax
public static class LinkedTokenSourceFactory
Methods
| Edit this page View SourceCausedBy<TSource>(OperationCanceledException, TSource?, CancellationToken)
Determines whether the operation was canceled by the specified source.
Declaration
public static bool CausedBy<TSource>(this OperationCanceledException e, TSource? source, CancellationToken token) where TSource : IMultiplexedCancellationTokenSource?
Parameters
| Type | Name | Description |
|---|---|---|
| OperationCanceledException | e | The exception to analyze. |
| TSource | source | The linked token source. |
| CancellationToken | token | The token to check |
Returns
| Type | Description |
|---|---|
| bool | true indicates that the cancellation caused by |
Type Parameters
| Name | Description |
|---|---|
| TSource |
LinkTo(ref CancellationToken, ReadOnlySpan<CancellationToken>)
Links multiple cancellation tokens together.
Declaration
[Obsolete("Use CancellationTokenMultiplexer class instead.")]
public static LinkedCancellationTokenSource? LinkTo(this ref CancellationToken first, ReadOnlySpan<CancellationToken> tokens)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | first | The first cancellation token. Can be modified by this method. |
| ReadOnlySpan<CancellationToken> | tokens | A list of cancellation tokens to link together. |
Returns
| Type | Description |
|---|---|
| LinkedCancellationTokenSource | The linked token source; or null if |
LinkTo(ref CancellationToken, CancellationToken)
Links two cancellation tokens together.
Declaration
[Obsolete("Use CancellationTokenMultiplexer class instead.")]
public static LinkedCancellationTokenSource? LinkTo(this ref CancellationToken first, CancellationToken second)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | first | The first cancellation token. Can be modified by this method. |
| CancellationToken | second | The second cancellation token. |
Returns
| Type | Description |
|---|---|
| LinkedCancellationTokenSource | The linked token source; or null if |
LinkTo(ref CancellationToken, TimeSpan)
Links cancellation token with the timeout.
Declaration
[Obsolete("Use CancellationTokenMultiplexer class instead.")]
public static CancellationTokenSource? LinkTo(this ref CancellationToken token, TimeSpan timeout)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | token | The first cancellation token. Can be modified by this method. |
| TimeSpan | timeout | The timeout to link. |
Returns
| Type | Description |
|---|---|
| CancellationTokenSource | The linked token source; or null if |
LinkTo(ref CancellationToken, TimeSpan, CancellationToken)
Links two cancellation tokens with the given timeout.
Declaration
[Obsolete("Use CancellationTokenMultiplexer class instead.")]
public static CancellationTokenSource? LinkTo(this ref CancellationToken first, TimeSpan timeout, CancellationToken second)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | first | The first cancellation token. Can be modified by this method. |
| TimeSpan | timeout | The timeout to link. |
| CancellationToken | second | The second cancellation token. |
Returns
| Type | Description |
|---|---|
| CancellationTokenSource | The linked token source; or null if not needed. |