Click or drag to resize

RecurringTaskScheduler Class

A scheduler for recurring tasks that attempts to run all of its tasks in a fair manner. The number of threads to be used to run tasks can be specified.
Inheritance Hierarchy
SystemObject
  AGI.Foundation.Infrastructure.ThreadingRecurringTaskScheduler

Namespace:  AGI.Foundation.Infrastructure.Threading
Assembly:  AGI.Foundation.Core (in AGI.Foundation.Core.dll) Version: 24.2.419.0 (24.2.419.0)
Syntax
public sealed class RecurringTaskScheduler : IDisposable

The RecurringTaskScheduler type exposes the following members.

Constructors
  NameDescription
Public methodRecurringTaskScheduler
Initializes a new instance. The scheduler uses the number of threads indicated by the ThreadingPolicy.
Public methodRecurringTaskScheduler(Int32)
Initializes a new instance to use a specified number of threads.
Top
Properties
  NameDescription
Public propertyIsRunning
Gets a value indicating whether the scheduler is running.
Public propertyNumberOfThreads
Gets the number of threads used to execute the recurring tasks.
Public propertyTaskCount
Gets the number of tasks.
Public propertyTasks
Gets the list of tasks.
Top
Methods
  NameDescription
Public methodAddTask
Adds a task to be executed on a recurring basis.
Public methodDispose
Stops running the scheduler if it is active.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetTaskData
Gets a copy of the performance metrics associated with the given recurring task.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodRemoveTask
Removes a task so that it is no longer executed on a recurring basis.
Public methodStart
Starts running the scheduler. This method returns once NumberOfThreads threads have been started.
Public methodStop
Stops running the scheduler. This method does not return until all threads have stopped.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Remarks
While every effort is made to ensure that tasks are run at their desired period, the accuracy of the scheduler is directly tied to both the precision and accuracy of GetTimestamp as well as Sleep(Int32).
See Also