TTMSMCPTaskRegistry Class
Thread-safe store of the long-running operations a server is tracking.
API unit family: TMS.MCP.Tasks
Syntax
TTMSMCPTaskRegistry = class
Remarks
The registry owns every task it holds and serializes all access internally, so it can be used from worker threads. Tasks whose lifetime has elapsed are removed when TTMSMCPTaskRegistry.PurgeExpiredTasks is called.
Methods
| Name | Description |
|---|---|
| CreateTask | Creates a task, gives it a new unique identifier and registers it. |
| GetAllTasks | Returns every registered task, across all sessions. |
| GetTask | Looks up a registered task by identifier. |
| MarkTaskInUse | Protects a task from being purged while a blocking request is reading it or waiting on it. |
| PurgeExpiredTasks | Removes and releases every task whose lifetime has elapsed. |
| SetTaskError | Stores the failure of a registered task, marks it failed and wakes the callers waiting for it to finish. |
| SetTaskResult | Stores the outcome of a registered task, marks it completed and wakes the callers waiting for it to finish. |
| UpdateTaskStatus | Moves a registered task to another state and wakes the callers waiting for it to finish. |