aboutsummaryrefslogtreecommitdiff
path: root/libbutl/process.ixx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-08-17 23:14:37 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-08-20 17:37:44 +0300
commit41f958c4cf68541a48b20ceb608afe2308a6e6a7 (patch)
treec4e92865e98b7a3b911d355525e984151b44da22 /libbutl/process.ixx
parentc00321b94d6b952d59257b4a7373a1199e874d98 (diff)
Add timed_wait() and kill() to process class, change try_wait() signature
Review Backup
Diffstat (limited to 'libbutl/process.ixx')
-rw-r--r--libbutl/process.ixx20
1 files changed, 12 insertions, 8 deletions
diff --git a/libbutl/process.ixx b/libbutl/process.ixx
index c2cd892..df3b588 100644
--- a/libbutl/process.ixx
+++ b/libbutl/process.ixx
@@ -223,14 +223,18 @@ namespace butl
return *this;
}
- inline bool process::
- try_wait (bool& s)
- {
- bool r (try_wait ());
-
- if (r)
- s = exit && exit->normal () && exit->code () == 0;
+ // Implement timed_wait() function templates in terms of their milliseconds
+ // specialization.
+ //
+ template <>
+ optional<bool> process::
+ timed_wait (const std::chrono::milliseconds&);
- return r;
+ template <typename R, typename P>
+ inline optional<bool> process::
+ timed_wait (const std::chrono::duration<R, P>& d)
+ {
+ using namespace std::chrono;
+ return timed_wait (duration_cast<milliseconds> (d));
}
}