]> git.tdb.fi Git - builder.git/commitdiff
Make wait applicable to all task types
authorMikko Rasa <tdb@tdb.fi>
Thu, 19 Jul 2012 10:37:35 +0000 (13:37 +0300)
committerMikko Rasa <tdb@tdb.fi>
Thu, 19 Jul 2012 10:37:35 +0000 (13:37 +0300)
source/externaltask.h
source/internaltask.cpp
source/internaltask.h
source/task.h

index a5f10ec0b0c1486ce6b7b951d8dd10e668923cfb..19ffe71e8fa4ff985a9c44805d608de351634cd4 100644 (file)
@@ -45,7 +45,7 @@ public:
        virtual std::string get_command() const;
        virtual void start();
        virtual Status check();
-       Status wait();
+       virtual Status wait();
 private:
        Status do_wait(bool);
 
index b8cbf115a460183189f87643da430806f9076a9a..c117bad897365f9e4159f7c58b9f9b764f6ae13c 100644 (file)
@@ -22,6 +22,13 @@ Task::Status InternalTask::check()
        return worker->get_status();
 }
 
+Task::Status InternalTask::wait()
+{
+       Status result;
+       while((result = worker->get_status())==RUNNING) ;
+       return result;
+}
+
 
 InternalTask::Worker::Worker():
        status(RUNNING)
index f29a61d29e8a35b7731340fe9df87a0457a13343..399e11937fe0d71e0532f85683aa48632f841286 100644 (file)
@@ -35,6 +35,7 @@ public:
        virtual std::string get_command() const { return "<internal>"; }
        virtual void start();
        virtual Status check();
+       virtual Status wait();
 };
 
 #endif
index 1f59473fd14f135da7933d18993f4936458e2e1c..9cf2bac9081b7b2c8df1627342aa1dd14600d8ff 100644 (file)
@@ -28,6 +28,7 @@ public:
        virtual std::string get_command() const = 0;
        virtual void start() = 0;
        virtual Status check() = 0;
+       virtual Status wait() = 0;
 };
 
 #endif