Table of Contents

Method AcquireAsync

Namespace
MailFathom.Application.SensitiveContent
Assembly
MailFathom.Application.dll

AcquireAsync(CancellationToken)

Waits for one permit and returns what releases it.

public Task<IDisposable> AcquireAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Cancels the wait.

Returns

Task<IDisposable>

The held permit, released when it is disposed.

Remarks

The permit is published as IDisposable rather than as a type of its own, because it is a scope a caller holds rather than a value one compares: the shape is BeginScope's, and the allocation it costs is one per scan beside the task the wait already allocated.

Exceptions

OperationCanceledException

Thrown when cancellationToken is cancelled.