Table of Contents

Class TaskScope

Namespace
Icicle
Assembly
Icicle.dll

Core abstraction for structured concurrency. TaskScope supports cases where a Task splits into several child Task, and where the child Task must complete before the main Task continues. A TaskScope can be used to ensure that the lifetime of a concurrent operation is confined by a using block, just like that of a sequential operation in structured programming.

public abstract class TaskScope : IDisposable
Inheritance
TaskScope
Implements
Derived
Inherited Members

Properties

IsRunTriggered

Returns true if Run(RunOptions?, CancellationToken) has been called

IsScopeComplete

Returns true if Run(RunOptions?, CancellationToken) has completed

IsScopeFaulted

Returns true if Run(RunOptions?, CancellationToken) has faulted

Methods

Add(Func<CancellationToken, ValueTask>)

Adds a child task to the scope returning a ResultHandle

Add<T>(Func<CancellationToken, ValueTask<T>>)

Adds a child task to the scope returning a ResultHandle<T>

Cancel()

Triggers cancellation on the TaskScope

Dispose()
Dispose(bool)

Extension point for hooking into Dispose()

OnRun(IEnumerable<ValueTask>, RunOptions, CancellationToken)

Called when a Run(RunOptions?, CancellationToken) is requested on the TaskScope

Run(RunOptions?, CancellationToken)

Runs all added child tasks; returning a RunToken that can be used as proof to exchange for child task results via ResultHandle<T> and ResultHandle