Class Runner
- Namespace
- MarymoorStudios.Core.Promises
- Assembly
- MarymoorStudios.Core.Promises.dll
Abstract based class for turn runners.
public abstract class Runner : IDisposable
- Inheritance
-
Runner
- Implements
- Inherited Members
Remarks
Turn runners can be registered with the scheduler. Each runner handles a source of turns external to the local Scheduler's computation (e.g. external IO).
Constructors
Runner()
protected Runner()
Properties
WaitHandle
A wait handle for efficient waiting for work.
public abstract WaitHandle WaitHandle { get; }
Property Value
Remarks
This wait handle should become signaled when Run() is likely to produce turns.
A Runner with a signaled wait handle is consider "runnable" and will be scheduled (according to a fair scheduling policy defined by the Scheduler in some order interleaved with other runnable Runners and other local turns.
It is acceptable for WaitHandle to over-signal (i.e. to become signaled even when Run() does NOT have work to do), but it MUST never be under-signaled (i.e. it MUST become signaled whenever Run() DOES have work to do). Under-signaled Runners will not be properly scheduled by the Scheduler.
Methods
Dispose()
public void Dispose()
Dispose(bool)
Standard dispose pattern for subclasses.
protected virtual void Dispose(bool disposing)
Parameters
disposing
boolTrue if both native and managed resources are being disposed. False if only native resources (i.e. in finalizer).
~Runner()
Finalizer.
protected ~Runner()
Run()
Performs work on behalf of the Runner.
protected abstract bool Run()
Returns
- bool
True if this Runner is still "runnable" after this call returns (and so should be scheduled again without waiting for WaitHandle to become signaled). False if this Runner is no longer "runnable" (has completed all pending work) and shouldn't be scheduled again until its WaitHandle becomes signaled once again.