Show / Hide Table of Contents

Class CancellationTokenMultiplexer

Represents cancellation token multiplexer.

Inheritance
object
CancellationTokenMultiplexer
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DotNext.Threading
Assembly: DotNext.Threading.dll
Syntax
public sealed class CancellationTokenMultiplexer
Remarks

The multiplexer provides a pool of CancellationTokenSource to combine the cancellation tokens.

Properties

| Edit this page View Source

MaximumRetained

Gets or sets the maximum retained CancellationTokenSource instances.

Declaration
public int MaximumRetained { get; init; }
Property Value
Type Description
int

Methods

| Edit this page View Source

Combine(ReadOnlySpan<CancellationToken>)

Combines the multiple tokens.

Declaration
public CancellationTokenMultiplexer.Scope Combine(ReadOnlySpan<CancellationToken> tokens)
Parameters
Type Name Description
ReadOnlySpan<CancellationToken> tokens

The tokens to be combined.

Returns
Type Description
CancellationTokenMultiplexer.Scope

The scope that contains a single multiplexed token.

| Edit this page View Source

Combine(TimeSpan, ReadOnlySpan<CancellationToken>)

Combines the multiple tokens and the timeout.

Declaration
public CancellationTokenMultiplexer.Scope Combine(TimeSpan timeout, ReadOnlySpan<CancellationToken> tokens)
Parameters
Type Name Description
TimeSpan timeout

The timeout that could trigger the cancellation.

ReadOnlySpan<CancellationToken> tokens

The tokens to be combined.

Returns
Type Description
CancellationTokenMultiplexer.Scope

The scope that represents the multiplexed token.

Remarks

The cancellation triggered by the timeout can be detected by checking IsTimedOut.

Exceptions
Type Condition
ArgumentOutOfRangeException

timeout is negative or too large.

| Edit this page View Source

CombineAndSetTimeoutLater(ReadOnlySpan<CancellationToken>)

Combines the multiple tokens and sets the timeout later.

Declaration
public CancellationTokenMultiplexer.ScopeWithTimeout CombineAndSetTimeoutLater(ReadOnlySpan<CancellationToken> tokens)
Parameters
Type Name Description
ReadOnlySpan<CancellationToken> tokens

The tokens to be combined.

Returns
Type Description
CancellationTokenMultiplexer.ScopeWithTimeout

The scope that represents the multiplexed token.

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.GetUserData<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
ExpressionBuilder.Const<T>(T)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾