summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/common
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2018-05-09 14:29:30 +0000
committerPavel Labath <labath@google.com>2018-05-09 14:29:30 +0000
commit3879fe0099c62d2afa67048e41f0426daea688ae (patch)
treefd3aa4f3085bba40040eab691764242fc0c0397f /lldb/source/Host/common
parente253f2f886a980c227a35508601bd0a6a5aba5c6 (diff)
downloadbcm5719-llvm-3879fe0099c62d2afa67048e41f0426daea688ae.tar.gz
bcm5719-llvm-3879fe0099c62d2afa67048e41f0426daea688ae.zip
Modernize and clean-up the Predicate class
Summary: The comments on this class were out of date with the implementation, and the implementation itself was inconsistent with our usage of the Timeout class (I started converting everything to use this class back in D27136, but I missed this one). I avoid duplicating the waiting logic by introducing a templated WaitFor function, and make other functions delegate to that. This function can be also used as a replacement for the unused WaitForBitToBeSet functions I removed, if it turns out to be necessary. As this changes the meaning of a "zero" timeout, I tracked down all the callers of these functions and updated them accordingly. Propagating the changes to all the callers of RunShellCommand was a bit too much for this patch, so I stopped there and will continue that in a follow-up patch. I also add some basic unittests for the functions I modified. Reviewers: jingham, clayborg Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D46580 llvm-svn: 331880
Diffstat (limited to 'lldb/source/Host/common')
-rw-r--r--lldb/source/Host/common/Host.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp
index 49f1f045aab..becd914650b 100644
--- a/lldb/source/Host/common/Host.cpp
+++ b/lldb/source/Host/common/Host.cpp
@@ -536,8 +536,11 @@ Status Host::RunShellCommand(const Args &args, const FileSpec &working_dir,
error.SetErrorString("failed to get process ID");
if (error.Success()) {
- if (!shell_info_sp->process_reaped.WaitForValueEqualTo(
- true, std::chrono::seconds(timeout_sec))) {
+ // TODO: Remove this and make the function take Timeout<> argument.
+ Timeout<std::micro> timeout(llvm::None);
+ if (timeout_sec != 0)
+ timeout = std::chrono::seconds(timeout_sec);
+ if (!shell_info_sp->process_reaped.WaitForValueEqualTo(true, timeout)) {
error.SetErrorString("timed out waiting for shell command to complete");
// Kill the process since it didn't complete within the timeout specified
OpenPOWER on IntegriCloud