CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
task.cxh
1/// @brief Task object with name, timing, and completion callbacks
2///
3/// @defgroup task Task
4/// @ingroup tq_task
5/// @{
6///
7/// Task extends BasicTask with additional features:
8/// - **Name** - String identifier for logging and monitoring
9/// - **Timing** - Tracks last time task was queued or run
10/// - **Completion callbacks** - Closure chain called when task completes (success or failure)
11/// - **Wait capability** - Can block waiting for task completion with timeout
12///
13/// This is the base class for most practical task implementations. Use Task instead of
14/// BasicTask when you need to track task identity, timing, or be notified of completion.
15///
16/// For tasks with dependencies, scheduling, or resource requirements, see ComplexTask.
17#include "basictask.cxh"
18#include <cx/closure.h>
19
20/// Task with name, timing information, and completion callbacks.
21[methodprefix ftask] abstract class Task extends BasicTask {
22 string name; ///< Task name shown in monitor output
23 int64 last; ///< Last time this task was moved between queues and/or run
24 cchain oncomplete; ///< Functions called when task completes (success or failure)
25
26 override reset;
27 /// Wait for this task to complete.
28 /// @param timeout Maximum time to wait, or 0 to wait indefinitely
29 /// @return true if task completed within timeout
30 bool wait(int64 timeout);
31 init();
32}
33/// @}