Nito.Disposables.SingleAsyncDisposable<T>
A base class for disposables that need exactly-once semantics in a thread-safe way. All disposals of this instance block until the disposal is complete.
namespace Nito.Disposables
{
public abstract class SingleAsyncDisposable<[System.Runtime.CompilerServices.Nullable(2)] T> : IAsyncDisposable
{
public bool IsDisposeStarted { get; }
public bool IsDisposed { get; }
public bool IsDisposing { get; }
protected SingleAsyncDisposable(T context);
protected abstract ValueTask DisposeAsync(T context);
public ValueTask DisposeAsync();
protected bool TryUpdateContext(Func<T, T> contextUpdater);
}
}