Table of Contents

Class ValueTaskDelaySource

Namespace
LfrlAnvil.Chrono.Async
Assembly
LfrlAnvil.Chrono.dll

Represents a source of value tasks that complete after a specified amount of time has passed.

public sealed class ValueTaskDelaySource : IDisposable, IAsyncDisposable
Inheritance
ValueTaskDelaySource
Implements
Inherited Members

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Remarks

All scheduled delays will be prematurely completed with Disposed result.

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

public ValueTask DisposeAsync()

Returns

ValueTask

A task that represents the asynchronous dispose operation.

Remarks

All scheduled delays will be prematurely completed with Disposed result.

GetResetEvent(bool)

Creates a new AsyncManualResetEvent instance backed by this delay source.

[Pure]
public AsyncManualResetEvent GetResetEvent(bool signaled = false)

Parameters

signaled bool

Specifies whether created event should start in signaled state. Equal to false by default.

Returns

AsyncManualResetEvent

New AsyncManualResetEvent instance.

Schedule(Duration, CancellationToken)

Schedules a new delay value task.

public ValueTask<ValueTaskDelayResult> Schedule(Duration delay, CancellationToken cancellationToken = default)

Parameters

delay Duration

Amount of time after which the returned value task completes.

cancellationToken CancellationToken

Optional CancellationToken instance.

Returns

ValueTask<ValueTaskDelayResult>

New ValueTask<TResult> instance which returns a ValueTaskDelayResult value.

Start(ITimestampProvider?)

Creates a new ValueTaskDelaySource instance.

[Pure]
public static ValueTaskDelaySource Start(ITimestampProvider? timestamps = null)

Parameters

timestamps ITimestampProvider

Optional Timestamp provider.

Returns

ValueTaskDelaySource

New ValueTaskDelaySource instance.

Start(TaskFactory, ITimestampProvider?)

Creates a new ValueTaskDelaySource instance.

[Pure]
public static ValueTaskDelaySource Start(TaskFactory taskFactory, ITimestampProvider? timestamps = null)

Parameters

taskFactory TaskFactory

TaskFactory instance that will be used to start an underlying task.

timestamps ITimestampProvider

Optional Timestamp provider.

Returns

ValueTaskDelaySource

New ValueTaskDelaySource instance.