Bewerken

Delen via


CancellationTokenSource.CreateLinkedTokenSource Method

Definition

Creates a CancellationTokenSource that will be in the canceled state when any of the source tokens are in the canceled state.

Overloads

CreateLinkedTokenSource(ReadOnlySpan<CancellationToken>)

Creates a CancellationTokenSource that will be in the canceled state when any of the source tokens are in the canceled state.

CreateLinkedTokenSource(CancellationToken)

Creates a CancellationTokenSource that will be in the canceled state when the supplied token is in the canceled state.

CreateLinkedTokenSource(CancellationToken[])

Creates a CancellationTokenSource that will be in the canceled state when any of the source tokens in the specified array are in the canceled state.

CreateLinkedTokenSource(CancellationToken, CancellationToken)

Creates a CancellationTokenSource that will be in the canceled state when any of the source tokens are in the canceled state.

CreateLinkedTokenSource(ReadOnlySpan<CancellationToken>)

Creates a CancellationTokenSource that will be in the canceled state when any of the source tokens are in the canceled state.

public:
 static System::Threading::CancellationTokenSource ^ CreateLinkedTokenSource(ReadOnlySpan<System::Threading::CancellationToken> tokens);
public static System.Threading.CancellationTokenSource CreateLinkedTokenSource (scoped ReadOnlySpan<System.Threading.CancellationToken> tokens);
static member CreateLinkedTokenSource : ReadOnlySpan<System.Threading.CancellationToken> -> System.Threading.CancellationTokenSource
Public Shared Function CreateLinkedTokenSource (tokens As ReadOnlySpan(Of CancellationToken)) As CancellationTokenSource

Parameters

tokens
ReadOnlySpan<CancellationToken>

The CancellationToken instances to observe.

Returns

A CancellationTokenSource that is linked to the source tokens.

Applies to

CreateLinkedTokenSource(CancellationToken)

Source:
CancellationTokenSource.cs
Source:
CancellationTokenSource.cs
Source:
CancellationTokenSource.cs

Creates a CancellationTokenSource that will be in the canceled state when the supplied token is in the canceled state.

public:
 static System::Threading::CancellationTokenSource ^ CreateLinkedTokenSource(System::Threading::CancellationToken token);
public static System.Threading.CancellationTokenSource CreateLinkedTokenSource (System.Threading.CancellationToken token);
static member CreateLinkedTokenSource : System.Threading.CancellationToken -> System.Threading.CancellationTokenSource
Public Shared Function CreateLinkedTokenSource (token As CancellationToken) As CancellationTokenSource

Parameters

token
CancellationToken

The cancellation token to observe.

Returns

An object that's linked to the source token.

Applies to

CreateLinkedTokenSource(CancellationToken[])

Source:
CancellationTokenSource.cs
Source:
CancellationTokenSource.cs
Source:
CancellationTokenSource.cs

Creates a CancellationTokenSource that will be in the canceled state when any of the source tokens in the specified array are in the canceled state.

public:
 static System::Threading::CancellationTokenSource ^ CreateLinkedTokenSource(... cli::array <System::Threading::CancellationToken> ^ tokens);
public static System.Threading.CancellationTokenSource CreateLinkedTokenSource (params System.Threading.CancellationToken[] tokens);
static member CreateLinkedTokenSource : System.Threading.CancellationToken[] -> System.Threading.CancellationTokenSource
Public Shared Function CreateLinkedTokenSource (ParamArray tokens As CancellationToken()) As CancellationTokenSource

Parameters

tokens
CancellationToken[]

An array that contains the cancellation token instances to observe.

Returns

A CancellationTokenSource that is linked to the source tokens.

Exceptions

A CancellationTokenSource associated with one of the source tokens has been disposed.

tokens is null.

tokens is empty.

See also

Applies to

CreateLinkedTokenSource(CancellationToken, CancellationToken)

Source:
CancellationTokenSource.cs
Source:
CancellationTokenSource.cs
Source:
CancellationTokenSource.cs

Creates a CancellationTokenSource that will be in the canceled state when any of the source tokens are in the canceled state.

public:
 static System::Threading::CancellationTokenSource ^ CreateLinkedTokenSource(System::Threading::CancellationToken token1, System::Threading::CancellationToken token2);
public static System.Threading.CancellationTokenSource CreateLinkedTokenSource (System.Threading.CancellationToken token1, System.Threading.CancellationToken token2);
static member CreateLinkedTokenSource : System.Threading.CancellationToken * System.Threading.CancellationToken -> System.Threading.CancellationTokenSource
Public Shared Function CreateLinkedTokenSource (token1 As CancellationToken, token2 As CancellationToken) As CancellationTokenSource

Parameters

token1
CancellationToken

The first cancellation token to observe.

token2
CancellationToken

The second cancellation token to observe.

Returns

A CancellationTokenSource that is linked to the source tokens.

Exceptions

A CancellationTokenSource associated with one of the source tokens has been disposed.

See also

Applies to