Show / Hide Table of Contents

Class WorkItemBase<TTime>

Represents a work item using TTime to represent due time.

Inheritance
System.Object
WorkItemBase<TTime>
Implements
System.IComparable<WorkItemBase<TTime>>
IWorkItem<TTime>
IWorkItem
Namespace: Reaqtive.Scheduler
Assembly: Reaqtive.Scheduler.dll
Syntax
public class WorkItemBase<TTime> : Object, IComparable<WorkItemBase<TTime>>, IWorkItem<TTime>, IWorkItem where TTime : IComparable<TTime>
Type Parameters
Name Description
TTime

The type used to represent due time. This type should implement System.IComparable<>.

Constructors

WorkItemBase(IScheduler, ISchedulerTask, TTime, IDisposable)

Initializes a new instance of the WorkItemBase<TTime> class.

Declaration
public WorkItemBase(IScheduler scheduler, ISchedulerTask task, TTime dueTime, IDisposable onCompleted)
Parameters
Type Name Description
IScheduler scheduler

The logical scheduler that owns the work item.

ISchedulerTask task

The task to execute.

TTime dueTime

The due time at which to execute the task.

System.IDisposable onCompleted

Resource to dispose when the task has finished executing.

Properties

DueTime

Gets or sets the due time at which to execute the task.

Declaration
public TTime DueTime { get; set; }
Property Value
Type Description
TTime

IsPaused

Gets or sets a value indicating whether this instance is paused.

Declaration
public bool IsPaused { get; set; }
Property Value
Type Description
System.Boolean

IsRunnable

Gets a value indicating whether this instance is runnable.

Declaration
public bool IsRunnable { get; }
Property Value
Type Description
System.Boolean

Priority

Gets the priority at which the task should be scheduled to run.

Declaration
public long Priority { get; }
Property Value
Type Description
System.Int64

Scheduler

Gets the logical scheduler that owns the work item.

Declaration
public IScheduler Scheduler { get; }
Property Value
Type Description
IScheduler

Task

Gets the task to execute.

Declaration
public ISchedulerTask Task { get; }
Property Value
Type Description
ISchedulerTask

Methods

CompareTo(WorkItemBase<TTime>)

Compares the current object with another object of the same type.

Declaration
public int CompareTo(WorkItemBase<TTime> other)
Parameters
Type Name Description
WorkItemBase<TTime> other

An object to compare with this object.

Returns
Type Description
System.Int32

A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has the following meanings:

  • Less than zero. This object is less than other.
  • Zero. This object is equal to other.
  • Greater than zero. This object is greater than other.

Invoke()

Runs this instance through the logical scheduler.

Declaration
public bool Invoke()
Returns
Type Description
System.Boolean

Flag indicating whether the item has completed.

Invoke(YieldToken)

Runs this instance through the logical scheduler.

Declaration
public bool Invoke(YieldToken yieldToken)
Parameters
Type Name Description
YieldToken yieldToken

Token to observe for yield requests.

Returns
Type Description
System.Boolean

Flag indicating whether the item has completed.

OnCompleted()

Called when the work item completes.

Declaration
protected virtual void OnCompleted()

RecalculatePriority()

Recalculates the priority.

Declaration
public void RecalculatePriority()

Implements

System.IComparable<>
IWorkItem<TTime>
IWorkItem
In This Article
Back to top Generated by DocFX