Scheduler.Sleep(IScheduler, TimeSpan) method¶
Defined in
Type: Scheduler
Namespace: System.Reactive.Concurrency
Assembly: System.Reactive.dll
Applies to
netstandard2.0
Overloads¶
- 1.
public static SchedulerOperation Sleep(this IScheduler scheduler, TimeSpan dueTime) - 2.
public static SchedulerOperation Sleep(this IScheduler scheduler, TimeSpan dueTime, CancellationToken cancellationToken) - 3.
public static SchedulerOperation Sleep(this IScheduler scheduler, DateTimeOffset dueTime) - 4.
public static SchedulerOperation Sleep(this IScheduler scheduler, DateTimeOffset dueTime, CancellationToken cancellationToken)
1. Overload¶
public static SchedulerOperation Sleep(this IScheduler scheduler, TimeSpan dueTime)
Summary: Suspends execution of the current work item on the scheduler for the specified duration. The caller should await the result of calling Sleep to schedule the remainder of the current work item (known as the continuation) after the specified duration.
Parameters
| Name | Type | Description |
|---|---|---|
scheduler | [IScheduler](# | Scheduler to yield work on. |
dueTime | TimeSpan | Time when the continuation should run. |
Returns: SchedulerOperation -- Scheduler operation object to await in order to schedule the continuation.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | scheduler is null. |
2. Overload¶
public static SchedulerOperation Sleep(this IScheduler scheduler, TimeSpan dueTime, CancellationToken cancellationToken)
Summary: Suspends execution of the current work item on the scheduler for the specified duration. The caller should await the result of calling Sleep to schedule the remainder of the current work item (known as the continuation) after the specified duration.
Parameters
| Name | Type | Description |
|---|---|---|
scheduler | [IScheduler](# | Scheduler to yield work on. |
dueTime | TimeSpan | Time when the continuation should run. |
cancellationToken | CancellationToken | Cancellation token to cancel the continuation to run. |
Returns: SchedulerOperation -- Scheduler operation object to await in order to schedule the continuation.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | scheduler is null. |
3. Overload¶
public static SchedulerOperation Sleep(this IScheduler scheduler, DateTimeOffset dueTime)
Summary: Suspends execution of the current work item on the scheduler until the specified due time. The caller should await the result of calling Sleep to schedule the remainder of the current work item (known as the continuation) at the specified due time.
Parameters
| Name | Type | Description |
|---|---|---|
scheduler | [IScheduler](# | Scheduler to yield work on. |
dueTime | DateTimeOffset | Time when the continuation should run. |
Returns: SchedulerOperation -- Scheduler operation object to await in order to schedule the continuation.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | scheduler is null. |
4. Overload¶
public static SchedulerOperation Sleep(this IScheduler scheduler, DateTimeOffset dueTime, CancellationToken cancellationToken)
Summary: Suspends execution of the current work item on the scheduler until the specified due time. The caller should await the result of calling Sleep to schedule the remainder of the current work item (known as the continuation) at the specified due time.
Parameters
| Name | Type | Description |
|---|---|---|
scheduler | [IScheduler](# | Scheduler to yield work on. |
dueTime | DateTimeOffset | Time when the continuation should run. |
cancellationToken | CancellationToken | Cancellation token to cancel the continuation to run. |
Returns: SchedulerOperation -- Scheduler operation object to await in order to schedule the continuation.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | scheduler is null. |