Interface IScheduler (3.2.0)

public interface IScheduler

Abstraction of scheduler-like operations, used for testability.

Namespace

Google.Api.Gax

Assembly

Google.Api.Gax.dll

Remarks

Note that this is different to TaskScheduler, which is really involved with assigning tasks to threads rather than any sort of delay.

Methods

Delay(TimeSpan, CancellationToken)

Task Delay(TimeSpan delay, CancellationToken cancellationToken)

Returns a task which will complete after the given delay. Whether the returned awaitable is configured to capture the current context or not is implementation-specific. (A test implementation may capture the current context to enable reliable testing.)

Parameters
NameDescription
delayTimeSpan

Time to delay for. Must not be negative.

cancellationTokenCancellationToken

The cancellation token that will be checked prior to completing the returned task.

Returns
TypeDescription
Task

A task which will complete after the given delay.

Extension Method