Table of Contents

Method LinkTimeCancellationToken

Namespace
KZDev.PrimeTime
Assembly
KZDev.PrimeTime.dll

LinkTimeCancellationToken(Duration, CancellationToken)

Returns a disposable wrapper whose token is cancelled when either the specified duration elapses or the given cancellation token is cancelled. The caller is responsible for disposing the returned instance when no longer needed.

TimeCancellationTokenSource LinkTimeCancellationToken(Duration cancelAfter, CancellationToken cancellationToken)

Parameters

cancelAfter Duration

The duration to wait before cancelling the token.

cancellationToken CancellationToken

The cancellation token to link.

Returns

TimeCancellationTokenSource

A TimeCancellationTokenSource. Caller must dispose.

Remarks

Implementations may clamp values: zero or negative is treated as zero; durations greater than MaxValue milliseconds are clamped to that value, which is the maximum delay supported by CancellationTokenSource.

LinkTimeCancellationToken(Duration, CancellationToken, CancellationToken)

Returns a disposable wrapper whose token is cancelled when the specified duration elapses or any of the given tokens is cancelled. The caller is responsible for disposing the returned instance when no longer needed.

TimeCancellationTokenSource LinkTimeCancellationToken(Duration cancelAfter, CancellationToken firstCancellationToken, CancellationToken secondCancellationToken)

Parameters

cancelAfter Duration

The duration to wait before cancelling the token.

firstCancellationToken CancellationToken

The first cancellation token to link.

secondCancellationToken CancellationToken

The second cancellation token to link.

Returns

TimeCancellationTokenSource

A TimeCancellationTokenSource. Caller must dispose.

Remarks

Implementations may clamp values: zero or negative is treated as zero; durations greater than MaxValue milliseconds are clamped to that value, which is the maximum delay supported by CancellationTokenSource.

LinkTimeCancellationToken(Duration, params CancellationToken[])

Returns a disposable wrapper whose token is cancelled when the specified duration elapses or any of the given tokens is cancelled. The caller is responsible for disposing the returned instance when no longer needed.

TimeCancellationTokenSource LinkTimeCancellationToken(Duration cancelAfter, params CancellationToken[] cancellationTokens)

Parameters

cancelAfter Duration

The duration to wait before cancelling the token.

cancellationTokens CancellationToken[]

The cancellation tokens to link.

Returns

TimeCancellationTokenSource

A TimeCancellationTokenSource. Caller must dispose.

Remarks

Implementations may clamp values: zero or negative is treated as zero; durations greater than MaxValue milliseconds are clamped to that value, which is the maximum delay supported by CancellationTokenSource.

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.

TimeCancellationTokenSource LinkTimeCancellationToken(int cancelMilliseconds, CancellationToken token1, CancellationToken token2)

Parameters

cancelMilliseconds int

The number of milliseconds to wait before cancelling the token.

token1 CancellationToken

The first cancellation token to link.

token2 CancellationToken

The second cancellation token to link.

Returns

TimeCancellationTokenSource

A TimeCancellationTokenSource. Caller must dispose.

Exceptions

ArgumentOutOfRangeException

cancelMilliseconds is 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.

TimeCancellationTokenSource LinkTimeCancellationToken(TimeSpan cancelTime, CancellationToken token1, CancellationToken token2)

Parameters

cancelTime TimeSpan

The time to wait before cancelling the token.

token1 CancellationToken

The first cancellation token to link.

token2 CancellationToken

The second cancellation token to link.

Returns

TimeCancellationTokenSource

A TimeCancellationTokenSource. Caller must dispose.

Exceptions

ArgumentOutOfRangeException

cancelTime is 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.

TimeCancellationTokenSource LinkTimeCancellationToken(TimeSpan cancelTime, CancellationToken cancellationToken)

Parameters

cancelTime TimeSpan

The time to wait before cancelling the token.

cancellationToken CancellationToken

The cancellation token to link; when it is cancelled, the returned wrapper's token is cancelled.

Returns

TimeCancellationTokenSource

A TimeCancellationTokenSource. Caller must dispose.

Exceptions

ArgumentOutOfRangeException

cancelTime is 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.

TimeCancellationTokenSource LinkTimeCancellationToken(int cancelMilliseconds, CancellationToken cancellationToken)

Parameters

cancelMilliseconds int

The number of milliseconds to wait before cancelling the token.

cancellationToken CancellationToken

The cancellation token to link; when it is cancelled, the returned wrapper's token is cancelled.

Returns

TimeCancellationTokenSource

A TimeCancellationTokenSource. Caller must dispose.

Exceptions

ArgumentOutOfRangeException

cancelMilliseconds is 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.

TimeCancellationTokenSource LinkTimeCancellationToken(TimeSpan cancelTime, params CancellationToken[] cancellationTokens)

Parameters

cancelTime TimeSpan

The time to wait before cancelling the token.

cancellationTokens CancellationToken[]

The cancellation tokens to link.

Returns

TimeCancellationTokenSource

A TimeCancellationTokenSource. Caller must dispose.

Exceptions

ArgumentNullException

cancellationTokens is null.

ArgumentOutOfRangeException

cancelTime is 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.

TimeCancellationTokenSource LinkTimeCancellationToken(int cancelMilliseconds, params CancellationToken[] cancellationTokens)

Parameters

cancelMilliseconds int

The number of milliseconds to wait before cancelling the token.

cancellationTokens CancellationToken[]

The cancellation tokens to link.

Returns

TimeCancellationTokenSource

A TimeCancellationTokenSource. Caller must dispose.

Exceptions

ArgumentNullException

cancellationTokens is null.

ArgumentOutOfRangeException

cancelMilliseconds is less than -1.