Method LinkTimeCancellationToken
- Namespace
- KZDev.SystemClock.PrimeTime.Testing
- Assembly
- KZDev.SystemClock.PrimeTime.Testing.dll
LinkTimeCancellationToken(int, CancellationToken, CancellationToken)
Returns a disposable wrapper whose token is cancelled when the specified time elapses or any of the given tokens is cancelled. Disposing the returned instance disposes all underlying sources (including internal time-based sources). The caller is responsible for disposing the returned instance when no longer needed.
public TimeCancellationTokenSource LinkTimeCancellationToken(int cancelMilliseconds, CancellationToken token1, CancellationToken token2)
Parameters
cancelMillisecondsintThe number of milliseconds to wait before cancelling the token.
token1CancellationTokenThe first cancellation token to link.
token2CancellationTokenThe second cancellation token to link.
Returns
- TimeCancellationTokenSource
A TimeCancellationTokenSource. Caller must dispose.
Exceptions
- ArgumentOutOfRangeException
cancelMillisecondsis less than -1.
LinkTimeCancellationToken(TimeSpan, CancellationToken, CancellationToken)
Returns a disposable wrapper whose token is cancelled when the specified time elapses or any of the given tokens is cancelled. Disposing the returned instance disposes all underlying sources (including internal time-based sources). The caller is responsible for disposing the returned instance when no longer needed.
public TimeCancellationTokenSource LinkTimeCancellationToken(TimeSpan cancelTime, CancellationToken token1, CancellationToken token2)
Parameters
cancelTimeTimeSpanThe time to wait before cancelling the token.
token1CancellationTokenThe first cancellation token to link.
token2CancellationTokenThe second cancellation token to link.
Returns
- TimeCancellationTokenSource
A TimeCancellationTokenSource. Caller must dispose.
Exceptions
- ArgumentOutOfRangeException
cancelTimeis not a valid delay (for example, negative and not an infinite timeout, or too large to express in milliseconds).
LinkTimeCancellationToken(TimeSpan, CancellationToken)
Returns a disposable wrapper whose token is cancelled when either the specified time elapses or the given cancellation token is cancelled. Disposing the returned instance disposes all underlying sources (including internal time-based sources). The caller is responsible for disposing the returned instance when no longer needed.
public TimeCancellationTokenSource LinkTimeCancellationToken(TimeSpan cancelTime, CancellationToken cancellationToken)
Parameters
cancelTimeTimeSpanThe time to wait before cancelling the token.
cancellationTokenCancellationTokenThe cancellation token to link; when it is cancelled, the returned wrapper's token is cancelled.
Returns
- TimeCancellationTokenSource
A TimeCancellationTokenSource. Caller must dispose.
Exceptions
- ArgumentOutOfRangeException
cancelTimeis not a valid delay (for example, negative and not an infinite timeout, or too large to express in milliseconds).
LinkTimeCancellationToken(int, CancellationToken)
Returns a disposable wrapper whose token is cancelled when either the specified time elapses or the given cancellation token is cancelled. Disposing the returned instance disposes all underlying sources (including internal time-based sources). The caller is responsible for disposing the returned instance when no longer needed.
public TimeCancellationTokenSource LinkTimeCancellationToken(int cancelMilliseconds, CancellationToken cancellationToken)
Parameters
cancelMillisecondsintThe number of milliseconds to wait before cancelling the token.
cancellationTokenCancellationTokenThe cancellation token to link; when it is cancelled, the returned wrapper's token is cancelled.
Returns
- TimeCancellationTokenSource
A TimeCancellationTokenSource. Caller must dispose.
Exceptions
- ArgumentOutOfRangeException
cancelMillisecondsis less than -1.
LinkTimeCancellationToken(TimeSpan, params CancellationToken[])
Returns a disposable wrapper whose token is cancelled when the specified time elapses or any of the given tokens is cancelled. Disposing the returned instance disposes all underlying sources (including internal time-based sources). The caller is responsible for disposing the returned instance when no longer needed.
public TimeCancellationTokenSource LinkTimeCancellationToken(TimeSpan cancelTime, params CancellationToken[] cancellationTokens)
Parameters
cancelTimeTimeSpanThe time to wait before cancelling the token.
cancellationTokensCancellationToken[]The cancellation tokens to link.
Returns
- TimeCancellationTokenSource
A TimeCancellationTokenSource. Caller must dispose.
Exceptions
- ArgumentNullException
cancellationTokensis null.- ArgumentOutOfRangeException
cancelTimeis not a valid delay (for example, negative and not an infinite timeout, or too large to express in milliseconds).
LinkTimeCancellationToken(int, params CancellationToken[])
Returns a disposable wrapper whose token is cancelled when the specified time elapses or any of the given tokens is cancelled. Disposing the returned instance disposes all underlying sources (including internal time-based sources). The caller is responsible for disposing the returned instance when no longer needed.
public TimeCancellationTokenSource LinkTimeCancellationToken(int cancelMilliseconds, params CancellationToken[] cancellationTokens)
Parameters
cancelMillisecondsintThe number of milliseconds to wait before cancelling the token.
cancellationTokensCancellationToken[]The cancellation tokens to link.
Returns
- TimeCancellationTokenSource
A TimeCancellationTokenSource. Caller must dispose.
Exceptions
- ArgumentNullException
cancellationTokensis null.- ArgumentOutOfRangeException
cancelMillisecondsis less than -1.