18 #ifndef MAUVE_RUNTIME_TASK_HPP 19 #define MAUVE_RUNTIME_TASK_HPP 30 #define TASK_MQ_MAX_MSG 10 31 #define TASK_SIG SIGUSR1 36 class AbstractComponent;
37 class ComponentLogger;
41 enum TaskStatus { CREATED, ACTIVATED, RUNNING };
63 inline TaskStatus get_status()
const {
return status; }
87 bool start(time_ns_t start_time, pthread_barrier_t * barrier =
nullptr);
105 static void *thread_start(
void *data);
111 std::atomic<TaskStatus> status;
113 std::atomic<bool> finish;
115 pthread_t pthread_id;
121 pthread_barrier_t barrier;
123 std::atomic<pthread_barrier_t *> start_barrier;
129 struct itimerspec its;
Class of a MAUVE logger for a component.
Definition: logger.hpp:188
std::string to_string() const
Get a string representation of this task.
bool stop()
Stop the task.
bool start(time_ns_t start_time, pthread_barrier_t *barrier=nullptr)
Start the task.
Task(AbstractComponent *component)
Create a task associated to a component.
AbstractComponent * get_component()
Get the component associated to this task.
The MAUVE namespace.
Definition: tracing.hpp:24
time_ns_t get_time() const
Get the clock of the task.
bool activate()
Activate the task.
pthread_t thread_id() const
Get the thread ID of this task.
ComponentLogger * logger
A pointer to a logger.
Definition: Task.hpp:102
Abstract Component class.
Definition: AbstractComponent.hpp:43
A system Task that executes a component.
Definition: Task.hpp:46