]> git.tdb.fi Git - builder.git/commitdiff
Don't start tasks automatically upon creation
authorMikko Rasa <tdb@tdb.fi>
Thu, 10 May 2012 21:19:35 +0000 (00:19 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 8 Jul 2012 21:08:51 +0000 (00:08 +0300)
source/builder.cpp
source/copy.cpp
source/externaltask.cpp
source/externaltask.h
source/internaltask.cpp
source/internaltask.h
source/pkgconfiggenerator.cpp
source/tar.cpp
source/task.h

index 9fdb8ee6a56e6b9fb5dfa709cd8d6e90cfdd596e..9dfa2e693fdeb8ff27afcb0cd7383f381b3da1ec 100644 (file)
@@ -584,7 +584,10 @@ int Builder::do_build()
                                        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" : ""));
index 30ab60e446b6ae8353112a5e707a8fb21ddf7355..5b524a40cd367d5e1973c6d2edfacc7d17ef33d5 100644 (file)
@@ -35,9 +35,7 @@ Task *Copy::run(const Target &target) const
 
 Copy::Worker::Worker(const InstalledFile &t):
        target(t)
-{
-       launch();
-}
+{ }
 
 void Copy::Worker::main()
 {
index c205cbcf1a5c704f92aeed61cda08537c580224d..672762b91bb2b35ede371ade85820d3090175205 100644 (file)
@@ -11,6 +11,9 @@ using namespace Msp;
 ExternalTask::ExternalTask(const vector<string> &argv, const FS::Path &work_dir):
        pid(-1),
        exit_code(-1)
+{ }
+
+void ExternalTask::start()
 {
        if((pid = fork()))
        {
index 1701313b515f1e881d8bf27a725ffe2dc5ee7469..3028e74ddb998ae1db611a05285c3f2d7d635be5 100644 (file)
@@ -15,6 +15,7 @@ private:
 public:
        ExternalTask(const std::vector<std::string> &, const Msp::FS::Path &);
 
+       virtual void start();
        virtual Status check();
 };
 
index 42932034c1435d4a655182b7189f86068bf9b5fb..37c9b75de91a9fb5962cb58584749245308cc9a0 100644 (file)
@@ -9,6 +9,11 @@ InternalTask::~InternalTask()
        delete worker;
 }
 
+void InternalTask::start()
+{
+       worker->launch();
+}
+
 Task::Status InternalTask::check()
 {
        if(worker->get_status()!=RUNNING)
index ea25ba89eca0816751d8f13687b5e4aa5afeefd8..9e52247a258f3429095d73db17a04dd1535c560d 100644 (file)
@@ -9,6 +9,8 @@ class InternalTask: public Task
 public:
        class Worker: public Msp::Thread
        {
+               friend class InternalTask;
+
        protected:
                Status status;
 
@@ -25,6 +27,7 @@ public:
        InternalTask(Worker *);
        ~InternalTask();
 
+       virtual void start();
        virtual Status check();
 };
 
index 555d8c56db797bc5fda9e2e72842bcea4726fc51..b18402a6d28001c671d46e59a4ff547c57c4805e 100644 (file)
@@ -28,9 +28,7 @@ Task *PkgConfigGenerator::run(const Target &target) const
 
 PkgConfigGenerator::Worker::Worker(const PkgConfig &t):
        target(t)
-{
-       launch();
-}
+{ }
 
 void PkgConfigGenerator::Worker::main()
 {
index b49e6fe08a7279b3bdddcde002955b4516cf50df..49b4c0851fd9b26f74df1c4c557af80d3c3ae432 100644 (file)
@@ -38,9 +38,7 @@ Task *Tar::run(const Target &target) const
 
 Tar::Worker::Worker(const TarBall &tb):
        tarball(tb)
-{
-       launch();
-}
+{ }
 
 void Tar::Worker::main()
 {
index d2cf5a4ccec91b78e051b8cca8577ba9762f6dc6..03d212bc74af1ac1b7eaaaaabfe8f7ec0e64aa72 100644 (file)
@@ -20,6 +20,7 @@ protected:
 public:
        virtual ~Task() { }
 
+       virtual void start() = 0;
        virtual Status check() = 0;
 };