1 #ifndef INTERNALTASK_H_
2 #define INTERNALTASK_H_
5 #include <msp/core/thread.h>
9 Runs a worker thread. Tools should derive a thread class from
10 InternalTask::Worker. The worker thread must set its status to either SUCCESS
11 or ERROR before terminating.
13 class InternalTask: public Task
16 class Worker: public Msp::Thread
18 friend class InternalTask;
21 std::function<bool()> func;
22 volatile Status status = Task::RUNNING;
25 Worker(std::function<bool()> f): func(f) { }
27 Status get_status() const { return status; }
36 InternalTask(std::function<bool()> f): worker(f) { }
39 std::string get_command() const override { return "<internal>"; }
40 void start() override;
41 Status check() override;
42 Status wait() override;