aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2017-07-03 09:25:55 +0000
committerPavel Labath <labath@google.com>2017-07-03 09:25:55 +0000
commitc1a6b128c710b2cde0bad5033052aa737291635e (patch)
tree48286437326a2b50084a49759a34663ffffabeda /lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
parentc5e54ddab31ca40a93e61f277d2bbd349fb84f3e (diff)
downloadllvm-c1a6b128c710b2cde0bad5033052aa737291635e.tar.gz
llvm-c1a6b128c710b2cde0bad5033052aa737291635e.tar.bz2
llvm-c1a6b128c710b2cde0bad5033052aa737291635e.zip
Use llvm::sys::RetryAfterSignal instead of a manual while errno!=EINTR loop
Reviewers: zturner, eugene, krytarowski Subscribers: emaste, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D33831 llvm-svn: 307009
Diffstat (limited to 'lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp')
-rw-r--r--lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
index 8e378802de9c..713d56d2bf59 100644
--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -662,14 +662,11 @@ void NativeProcessLinux::WaitForNewThread(::pid_t tid) {
// The thread is not tracked yet, let's wait for it to appear.
int status = -1;
- ::pid_t wait_pid;
- do {
- LLDB_LOG(log,
- "received thread creation event for tid {0}. tid not tracked "
- "yet, waiting for thread to appear...",
- tid);
- wait_pid = waitpid(tid, &status, __WALL);
- } while (wait_pid == -1 && errno == EINTR);
+ LLDB_LOG(log,
+ "received thread creation event for tid {0}. tid not tracked "
+ "yet, waiting for thread to appear...",
+ tid);
+ ::pid_t wait_pid = llvm::sys::RetryAfterSignal(-1, ::waitpid, tid, &status, __WALL);
// Since we are waiting on a specific tid, this must be the creation event.
// But let's do some checks just in case.
if (wait_pid != tid) {
@@ -2363,15 +2360,13 @@ void NativeProcessLinux::SigchldHandler() {
// Process all pending waitpid notifications.
while (true) {
int status = -1;
- ::pid_t wait_pid = waitpid(-1, &status, __WALL | __WNOTHREAD | WNOHANG);
+ ::pid_t wait_pid = llvm::sys::RetryAfterSignal(-1, ::waitpid, -1, &status,
+ __WALL | __WNOTHREAD | WNOHANG);
if (wait_pid == 0)
break; // We are done.
if (wait_pid == -1) {
- if (errno == EINTR)
- continue;
-
Status error(errno, eErrorTypePOSIX);
LLDB_LOG(log, "waitpid (-1, &status, _) failed: {0}", error);
break;