DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="5.11.0" />

 SpawningAsyncTaskMethodBuilder

When applied to async method using AsyncMethodBuilderAttribute attribute, spawns method execution as a new work item in the thread pool, i.e. in parallel.
public Task Task { get; }

Gets the task representing the builder's asynchronous operation.

When applied to async method using AsyncMethodBuilderAttribute attribute, spawns method execution as a new work item in the thread pool, i.e. in parallel.

Initializes a new builder.

public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : INotifyCompletion where TStateMachine : IAsyncStateMachine

Schedules the specified state machine to be pushed forward when the specified awaiter completes.

public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : ICriticalNotifyCompletion where TStateMachine : IAsyncStateMachine

Schedules the specified state machine to be pushed forward when the specified awaiter completes; without capturing execution context.

public void SetException(Exception e)

Completes asynchronous operation unsuccessfully.

public void SetResult()

Completes asynchronous operation successfully.

public void SetStateMachine(IAsyncStateMachine stateMachine)

Associates the builder with the state machine it represents.

public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine

Initiates the builder's execution with the associated state machine.