DotNext.Threading by .NET Foundation and Contributors

<PackageReference Include="DotNext.Threading" Version="5.12.0" />

 ManualResetCompletionSource

public abstract class ManualResetCompletionSource
Represents base class for producer of value task.
protected const short InitialCompletionToken = -32768

Represents initial value of the completion token when constructing a new instance of the completion source.

protected object CompletionData { get; }

Gets a value passed to the manual completion method.

public bool IsCompleted { get; }

Gets a value indicating that this source is in signaled (completed) state.

Gets the status of this source.

protected virtual void AfterConsumed()

Invokes when this source is ready to reuse.

protected virtual void CleanUp()

Resets internal state of this source.

public short Reset()

Resets the state of the source.

public bool TryReset(out short token)

Attempts to reset the state of this source.

public bool TrySetCanceled(CancellationToken token)

Attempts to complete the task unsuccessfully.

public abstract bool TrySetCanceled(object completionData, CancellationToken token)

Attempts to complete the task unsuccessfully.

public bool TrySetException(Exception e)

Attempts to complete the task unsuccessfully.

public abstract bool TrySetException(object completionData, Exception e)

Attempts to complete the task unsuccessfully.