IO::print("%-4s %s\n", tgt->get_tool()->get_tag(), tgt->get_name());
Task *task = tgt->build();
if(task)
+ {
+ task->start();
tasks.push_back(task);
+ }
if(show_progress)
IO::print("%d of %d target%s built\033[1G", count, total, (total!=1 ? "s" : ""));
Copy::Worker::Worker(const InstalledFile &t):
target(t)
-{
- launch();
-}
+{ }
void Copy::Worker::main()
{
ExternalTask::ExternalTask(const vector<string> &argv, const FS::Path &work_dir):
pid(-1),
exit_code(-1)
+{ }
+
+void ExternalTask::start()
{
if((pid = fork()))
{
public:
ExternalTask(const std::vector<std::string> &, const Msp::FS::Path &);
+ virtual void start();
virtual Status check();
};
delete worker;
}
+void InternalTask::start()
+{
+ worker->launch();
+}
+
Task::Status InternalTask::check()
{
if(worker->get_status()!=RUNNING)
public:
class Worker: public Msp::Thread
{
+ friend class InternalTask;
+
protected:
Status status;
InternalTask(Worker *);
~InternalTask();
+ virtual void start();
virtual Status check();
};
PkgConfigGenerator::Worker::Worker(const PkgConfig &t):
target(t)
-{
- launch();
-}
+{ }
void PkgConfigGenerator::Worker::main()
{
Tar::Worker::Worker(const TarBall &tb):
tarball(tb)
-{
- launch();
-}
+{ }
void Tar::Worker::main()
{
public:
virtual ~Task() { }
+ virtual void start() = 0;
virtual Status check() = 0;
};