From 41f958c4cf68541a48b20ceb608afe2308a6e6a7 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 17 Aug 2018 23:14:37 +0300 Subject: Add timed_wait() and kill() to process class, change try_wait() signature Review Backup --- libbutl/process.ixx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'libbutl/process.ixx') 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 process:: + timed_wait (const std::chrono::milliseconds&); - return r; + template + inline optional process:: + timed_wait (const std::chrono::duration& d) + { + using namespace std::chrono; + return timed_wait (duration_cast (d)); } } -- cgit v1.1