Class LogicalScheduler
Class representing a logical scheduler.
Inheritance
Implements
Namespace: Reaqtive.Scheduler
Assembly: Reaqtive.Scheduler.dll
Syntax
public sealed class LogicalScheduler : Object, ISchedulerStatus, IScheduler, IDisposable, ISchedulerExceptionHandler, ISchedulerPerformanceCountersProvider, IAccountable, IYieldTokenSource
Constructors
LogicalScheduler(PhysicalScheduler)
Initializes a new instance of the LogicalScheduler class.
Declaration
public LogicalScheduler(PhysicalScheduler scheduler)
Parameters
Type | Name | Description |
---|---|---|
PhysicalScheduler | scheduler | The scheduler. |
Properties
Now
Gets the current time.
Declaration
public DateTimeOffset Now { get; }
Property Value
Type | Description |
---|---|
System.DateTimeOffset |
Status
Gets the scheduler status.
Declaration
public SchedulerStatus Status { get; }
Property Value
Type | Description |
---|---|
SchedulerStatus |
Methods
CheckAccess()
Determines whether the calling thread has access to the scheduler.
Declaration
public bool CheckAccess()
Returns
Type | Description |
---|---|
System.Boolean |
|
Continue()
Continues all tasks on the scheduler and any of the child schedulers.
Declaration
public void Continue()
CreateChildScheduler()
Creates a new child scheduler.
Declaration
public IScheduler CreateChildScheduler()
Returns
Type | Description |
---|---|
IScheduler | A new child scheduler instance. |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
PauseAsync()
Asynchronously pauses all tasks on the scheduler and any of the child schedulers.
Declaration
public Task PauseAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task representing the eventual completion of pausing all tasks on the scheduler. |
QueryPerformanceCounters(Boolean)
Queries the current value of the performance counters.
Declaration
public SchedulerPerformanceCounters QueryPerformanceCounters(bool includeChildren)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | includeChildren |
|
Returns
Type | Description |
---|---|
SchedulerPerformanceCounters | The current value of the performance counters. |
RecalculatePriority()
Recalculates the priority of all tasks in the scheduler.
Declaration
public void RecalculatePriority()
Schedule(ISchedulerTask)
Schedules the specified task.
Declaration
public void Schedule(ISchedulerTask task)
Parameters
Type | Name | Description |
---|---|---|
ISchedulerTask | task | The task to schedule. |
Schedule(DateTimeOffset, ISchedulerTask)
Schedules the specified task at the specified absolute due time.
Declaration
public void Schedule(DateTimeOffset dueTime, ISchedulerTask task)
Parameters
Type | Name | Description |
---|---|---|
System.DateTimeOffset | dueTime | The due time. |
ISchedulerTask | task | The task to schedule. |
Schedule(TimeSpan, ISchedulerTask)
Schedules the specified task at the specified relative due time.
Declaration
public void Schedule(TimeSpan dueTime, ISchedulerTask task)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | dueTime | The due time. |
ISchedulerTask | task | The task to schedule. |
VerifyAccess()
Determines whether the calling thread has access to the scheduler.
Declaration
public void VerifyAccess()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The calling thread does not have access to this scheduler. |
Events
UnhandledException
Event to observe unhandled exceptions and optionally mark them as handled.
Declaration
public event EventHandler<SchedulerUnhandledExceptionEventArgs> UnhandledException
Event Type
Type | Description |
---|---|
System.EventHandler<SchedulerUnhandledExceptionEventArgs> |
Explicit Interface Implementations
ISchedulerExceptionHandler.TryCatch(Exception, IWorkItem)
Tries to handle an exception that was thrown by a work item running on the scheduler.
Declaration
bool ISchedulerExceptionHandler.TryCatch(Exception error, IWorkItem task)
Parameters
Type | Name | Description |
---|---|---|
System.Exception | error | Exception to handle. |
IWorkItem | task | Task that threw the exception. |
Returns
Type | Description |
---|---|
System.Boolean | true if the exception was handled; otherwise, false. |
IYieldTokenSource.IsYieldRequested
Gets a value indicating whether a yield has been requested.
Declaration
bool IYieldTokenSource.IsYieldRequested { get; }
Returns
Type | Description |
---|---|
System.Boolean |
IYieldTokenSource.Token
Gets the yield token used for cooperative pausing.
Declaration
YieldToken IYieldTokenSource.Token { get; }
Returns
Type | Description |
---|---|
YieldToken |