type TMtxProgressRuntime = class(TPersistent);
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
| Name | Description |
|---|---|
| Create | Create a new runtime with default settings. |
Properties
| Name | Type | Description |
|---|---|---|
| Cancel | Boolean | Cooperative cancellation flag. |
| Counter | Integer | Loop counter. |
| InfiniteLoop | Boolean | If true and TMtxProgressRuntime.InternalLoop is true, repeats until TMtxProgressRuntime.Cancel becomes true. |
| InternalLoop | Boolean | If false, TMtxProgressRuntime.OnCompute is called only once. |
| Loops | Integer | Number of loops to execute when TMtxProgressRuntime.InternalLoop is true. |
| Max | Integer | Upper index for loop. |
| Min | Integer | 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 TMtxProgressEvent.peCycle tick. |
| OnProgressUpdate | TProgressUpdateEvent | Lifecycle event: TMtxProgressEvent.peInit, TMtxProgressEvent.peCycle, 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 | Integer | Time interval (ms) between TMtxProgressEvent.peCycle notifications. |
| WorkerActive | Boolean | True while a background worker is active. |
Methods
| Name | Description |
|---|---|
| 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. |