Show / Hide Table of Contents

Interface IScheduler

Abstraction of scheduler-like operations, used for testability.

Namespace: Google.Api.Gax
Assembly: Google.Api.Gax.dll
Syntax
public interface IScheduler
Remarks

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

Methods

Delay(TimeSpan, 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.)

Declaration
Task Delay(TimeSpan delay, CancellationToken cancellationToken)
Parameters
Type Name Description
System.TimeSpan delay

Time to delay for. Must not be negative.

System.Threading.CancellationToken cancellationToken

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

Returns
Type Description
System.Threading.Tasks.Task

A task which will complete after the given delay.

Extension Methods

SchedulerExtensions.Sleep(IScheduler, TimeSpan, CancellationToken)
Back to top