]> git.tdb.fi Git - builder.git/blob - source/internaltask.h
Refactor transitive dependencies to work on all targets
[builder.git] / source / internaltask.h
1 #ifndef INTERNALTASK_H_
2 #define INTERNALTASK_H_
3
4 #include <msp/core/thread.h>
5 #include "task.h"
6
7 /**
8 Runs a worker thread.  Tools should derive a thread class from
9 InternalTask::Worker.  The worker thread must set its status to either SUCCESS
10 or ERROR before terminating.
11 */
12 class InternalTask: public Task
13 {
14 public:
15         class Worker: public Msp::Thread
16         {
17                 friend class InternalTask;
18
19         protected:
20                 volatile Status status;
21
22                 Worker();
23
24         public:
25                 Status get_status() const { return status; }
26         };
27
28 private:
29         Worker *worker;
30
31 public:
32         InternalTask(Worker *);
33         ~InternalTask();
34
35         virtual std::string get_command() const { return "<internal>"; }
36         virtual void start();
37         virtual Status check();
38         virtual Status wait();
39 };
40
41 #endif