Logo Orsak

CancellationScope Type

A scope of cancellation: a CancellationTokenSource that is cancelled when the token it is linked to is, and can be cancelled on its own without cancelling that token. Begun by Cancellation.within and Cancellation.timeout, and disposed when their effect ends, so each source lives exactly as long as the effects that use it.

It is the ICancellationProvider of the effects in the scope, so an environment grows in it by providing it as its source.

Record fields

Record Field Description

registration

Full Usage: registration

Field type: CancellationTokenRegistration
Modifiers: mutable

Instance members

Instance member Description

this.Parent

Full Usage: this.Parent

Returns: CancellationToken

The token the scope is linked to.

Returns: CancellationToken

Static members

Static member Description

CancellationScope.LinkedTo(token)

Full Usage: CancellationScope.LinkedTo(token)

Parameters:
Returns: CancellationScope

Begins a scope linked to token, already cancelled if the token is. Whoever begins it disposes it.

token : CancellationToken

The token whose cancellation cancels the scope.

Returns: CancellationScope

CancellationScope.NestedIn(source)

Full Usage: CancellationScope.NestedIn(source)

Parameters:
Returns: ValueTask<CancellationScope>

Begins a scope nested in source: the BeginScope of an environment whose ICancellationProvider is that source, such as one grown in a scope, so that a scope begun in a scope is cancelled with it. Myriad's [<GenEnvironment>] implements it so.

source : CancellationTokenSource

The source whose cancellation cancels the scope.

Returns: ValueTask<CancellationScope>

Type something to start searching.