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
| Name | Description |
|---|---|
| TMtxProgressRuntime (2) | Create a new runtime with default settings. |
Destructors
| Name | Description |
|---|---|
| ~TMtxProgressRuntime | Destroy the runtime and stop any running worker. |
Properties
| Name | Type | Description |
|---|---|---|
| Cancel | bool | Cooperative cancellation flag. |
| Counter | int | Loop counter. |
| InfiniteLoop | bool | If true and TMtxProgressRuntime::InternalLoop is true, repeats until TMtxProgressRuntime::Cancel becomes true. |
| InternalLoop | bool | If false, TMtxProgressRuntime::OnCompute is called only once. |
| Loops | int | Number of loops to execute when TMtxProgressRuntime::InternalLoop is true. |
| Max | int | Upper index for loop. |
| Min | int | 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. |
| OnThreadCleanUp | tNotifyEvent | |
| OnThreadInit | tNotifyEvent | |
| Priority | tThreadPriority | Executing thread priority. |
| TerminatingException | DewString | |
| ThreadBypass | bool | Bypass the background thread and execute synchronously (useful for testing). |
| ThreadName | DewString | Worker thread name (useful for debugging and diagnostics). |
| UpdateInterval | int | Time interval (ms) between TMtxProgressEvent::peCycle notifications. |
| WorkerActive | bool | True while a background worker is active. |
Methods
| Name | Description |
|---|---|
| DefineLoop | Set loop bounds in a single call. |
| DoCompute | |
| DoException | |
| DoProgressClean | |
| DoThreadCleanUp | |
| DoThreadInit | |
| SetInternalCleanUp | |
| SetInternalCompute | |
| SetInternalException | |
| SetInternalInitialize | |
| SetInternalProgress | |
| SetInternalProgressUpdate | |
| SetPriority | |
| 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. |
| WorkerTerminated |
Fields
| Name | Type | Description |
|---|---|---|
| FinishEvent | tEvent | |
| fSyncCtx | SynchronizationContext * |