TMtxProgressRuntime Class

Header: Dew.Math/MtxForLoop.h · Cross-compiler
tObjectTMtxProgressRuntime

class TMtxProgressRuntime : public tObject;

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 TMtxProgressRuntime::ThreadBypass.

Constructors

NameDescription
TMtxProgressRuntime (2)Create a new runtime with default settings.

Destructors

NameDescription
~TMtxProgressRuntimeDestroy the runtime and stop any running worker.

Properties

NameTypeDescription
CancelboolCooperative cancellation flag.
CounterintLoop counter.
InfiniteLoopboolIf true and TMtxProgressRuntime::InternalLoop is true, repeats until TMtxProgressRuntime::Cancel becomes true.
InternalLoopboolIf false, TMtxProgressRuntime::OnCompute is called only once.
LoopsintNumber of loops to execute when TMtxProgressRuntime::InternalLoop is true.
MaxintUpper index for loop.
MinintLower 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 TMtxProgressEvent::peCycle tick.
OnProgressUpdateTProgressUpdateEventLifecycle event: TMtxProgressEvent::peInit, TMtxProgressEvent::peCycle, TMtxProgressEvent::peCleanUp.
OnThreadCleanUptNotifyEvent
OnThreadInittNotifyEvent
PrioritytThreadPriorityExecuting thread priority.
TerminatingExceptionDewString
ThreadBypassboolBypass the background thread and execute synchronously (useful for testing).
ThreadNameDewStringWorker thread name (useful for debugging and diagnostics).
UpdateIntervalintTime interval (ms) between TMtxProgressEvent::peCycle notifications.
WorkerActiveboolTrue while a background worker is active.

Methods

NameDescription
DefineLoopSet loop bounds in a single call.
DoCompute
DoException
DoProgressClean
DoThreadCleanUp
DoThreadInit
SetInternalCleanUp
SetInternalCompute
SetInternalException
SetInternalInitialize
SetInternalProgress
SetInternalProgressUpdate
SetPriority
StartStart execution.
StopRequest cooperative cancellation and wait for the worker to exit.
TerminateSets cancel to True.
WaitToFinishBlock until the background job finishes.
WorkerTerminated

Fields

NameTypeDescription
FinishEventtEvent
fSyncCtxSynchronizationContext *