TMtxProgressRuntime Class

Source: MtxForLoop.cs · Assembly: Dew.Math

public class TMtxProgressRuntime

Runtime for background execution and progress reporting.

UI-free runtime designed as TPersistent so a host component (WinForms/VCL wrapper) can expose it as a streamable sub-object. Provides timer-driven progress cycles and cooperative cancellation. The counter is maintained by the worker when threaded, and by the runtime when executing synchronously with Dew.Math.TMtxProgressRuntime.ThreadBypass.

Properties

NameTypeDescription
CancelBooleanCooperative cancellation flag.
CounterInt32Loop counter.
InfiniteLoopBooleanIf true and Dew.Math.TMtxProgressRuntime.InternalLoop is true, repeats until Dew.Math.TMtxProgressRuntime.Cancel becomes true.
InternalLoopBooleanIf false, Dew.Math.TMtxProgressRuntime.OnCompute is called only once.
LoopsInt32Number of loops to execute when Dew.Math.TMtxProgressRuntime.InternalLoop is true.
MaxInt32Upper index for loop.
MinInt32Lower index for loop.
OnCleanUpTNotifyEventCalled after the job completes or is cancelled (on peCleanUp).
OnComputeTComputeEventThe user job to execute (runs on the worker thread).
OnExceptionTExceptionEventCalled if the worker raises an exception.
OnInitializeTNotifyEventCalled before execution starts (on TMtxProgressEvent.peInit).
OnProgressTNotifyEventCalled on each Dew.Math.TMtxProgressEvent.peCycle tick.
OnProgressUpdateTProgressUpdateEventLifecycle event: Dew.Math.TMtxProgressEvent.peInit, Dew.Math.TMtxProgressEvent.peCycle, Dew.Math.TMtxProgressEvent.peCleanUp.
PriorityThreadPriorityExecuting thread priority.
ThreadBypassBooleanBypass the background thread and execute synchronously (useful for testing).
ThreadNameStringWorker thread name (useful for debugging and diagnostics).
UpdateIntervalInt32Time interval (ms) between Dew.Math.TMtxProgressEvent.peCycle notifications.
WorkerActiveBooleanTrue while a background worker is active.

Methods

NameDescription
ctorCreate a new runtime with default settings.
DefineLoopSet loop bounds in a single call.
FreeDestroy the runtime and stop any running worker.
StartStart execution.
StopRequest cooperative cancellation and wait for the worker to exit.
TerminateSets cancel to True.
WaitToFinishBlock until the background job finishes.

Events

NameDescription
OnCleanUpEventCalled after the job completes or is cancelled (on peCleanUp).
OnComputeEventThe user job to execute (runs on the worker thread).
OnExceptionEventCalled if the worker raises an exception.
OnInitializeEventCalled before execution starts (on TMtxProgressEvent.peInit).
OnProgressEventCalled on each Dew.Math.TMtxProgressEvent.peCycle tick.
OnProgressUpdateEventLifecycle event: Dew.Math.TMtxProgressEvent.peInit, Dew.Math.TMtxProgressEvent.peCycle, Dew.Math.TMtxProgressEvent.peCleanUp.