about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libutil/sync.hh8
-rw-r--r--src/libutil/util.cc8
-rw-r--r--src/libutil/util.hh1
3 files changed, 17 insertions, 0 deletions
diff --git a/src/libutil/sync.hh b/src/libutil/sync.hh
index ebe64ffbdab7..2aa074299b23 100644
--- a/src/libutil/sync.hh
+++ b/src/libutil/sync.hh
@@ -54,6 +54,14 @@ public:
             cv.wait(lk);
         }
 
+        template<class Rep, class Period>
+        void wait_for(std::condition_variable & cv,
+            const std::chrono::duration<Rep, Period> & duration)
+        {
+            assert(s);
+            cv.wait_for(lk, duration);
+        }
+
         template<class Rep, class Period, class Predicate>
         bool wait_for(std::condition_variable & cv,
             const std::chrono::duration<Rep, Period> & duration,
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 1f923fe6bc0f..ce16cc30a5c7 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -778,6 +778,14 @@ void Pid::setKillSignal(int signal)
 }
 
 
+pid_t Pid::release()
+{
+    pid_t p = pid;
+    pid = -1;
+    return p;
+}
+
+
 void killUser(uid_t uid)
 {
     debug(format("killing all processes running under uid ‘%1%’") % uid);
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index 259c73260da3..50b96f7ed92c 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -220,6 +220,7 @@ public:
     int wait(bool block);
     void setSeparatePG(bool separatePG);
     void setKillSignal(int signal);
+    pid_t release();
 };