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
| Name | Type | Description |
|---|---|---|
| Cancel | Boolean | Cooperative cancellation flag. |
| Counter | Int32 | Loop counter. |
| InfiniteLoop | Boolean | If true and Dew.Math.TMtxProgressRuntime.InternalLoop is true, repeats until Dew.Math.TMtxProgressRuntime.Cancel becomes true. |
| InternalLoop | Boolean | If false, Dew.Math.TMtxProgressRuntime.OnCompute is called only once. |
| Loops | Int32 | Number of loops to execute when Dew.Math.TMtxProgressRuntime.InternalLoop is true. |
| Max | Int32 | Upper index for loop. |
| Min | Int32 | Lower index for loop. |
| OnCleanUp | TNotifyEvent | Called after the job completes or is cancelled (on peCleanUp). |
| OnCompute | TComputeEvent | The user job to execute (runs on the worker thread). |
| OnException | TExceptionEvent | Called if the worker raises an exception. |
| OnInitialize | TNotifyEvent | Called before execution starts (on TMtxProgressEvent.peInit). |
| OnProgress | TNotifyEvent | Called on each Dew.Math.TMtxProgressEvent.peCycle tick. |
| OnProgressUpdate | TProgressUpdateEvent | Lifecycle event: Dew.Math.TMtxProgressEvent.peInit, Dew.Math.TMtxProgressEvent.peCycle, Dew.Math.TMtxProgressEvent.peCleanUp. |
| Priority | ThreadPriority | Executing thread priority. |
| ThreadBypass | Boolean | Bypass the background thread and execute synchronously (useful for testing). |
| ThreadName | String | Worker thread name (useful for debugging and diagnostics). |
| UpdateInterval | Int32 | Time interval (ms) between Dew.Math.TMtxProgressEvent.peCycle notifications. |
| WorkerActive | Boolean | True while a background worker is active. |
Methods
| Name | Description |
|---|---|
| ctor | Create a new runtime with default settings. |
| DefineLoop | Set loop bounds in a single call. |
| Free | Destroy the runtime and stop any running worker. |
| Start | Start execution. |
| Stop | Request cooperative cancellation and wait for the worker to exit. |
| Terminate | Sets cancel to True. |
| WaitToFinish | Block until the background job finishes. |
Events
| Name | Description |
|---|---|
| OnCleanUpEvent | Called after the job completes or is cancelled (on peCleanUp). |
| OnComputeEvent | The user job to execute (runs on the worker thread). |
| OnExceptionEvent | Called if the worker raises an exception. |
| OnInitializeEvent | Called before execution starts (on TMtxProgressEvent.peInit). |
| OnProgressEvent | Called on each Dew.Math.TMtxProgressEvent.peCycle tick. |
| OnProgressUpdateEvent | Lifecycle event: Dew.Math.TMtxProgressEvent.peInit, Dew.Math.TMtxProgressEvent.peCycle, Dew.Math.TMtxProgressEvent.peCleanUp. |