Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1973)

Unified Diff: chrome/common/process_watcher_posix.cc

Issue 100225: POSIX: Add a macro for handling EINTR. (Closed)
Patch Set: ... Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/ipc_send_fds_test.cc ('k') | chrome/common/transport_dib_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/process_watcher_posix.cc
diff --git a/chrome/common/process_watcher_posix.cc b/chrome/common/process_watcher_posix.cc
index ef73521d52d85403180c88fdc26b50fdeb49bda1..d61f62f8e29cfcc5a8cb239faf52da824bc85a9c 100644
--- a/chrome/common/process_watcher_posix.cc
+++ b/chrome/common/process_watcher_posix.cc
@@ -9,12 +9,13 @@
#include <sys/types.h>
#include <sys/wait.h>
+#include "base/eintr_wrappers.h"
#include "base/platform_thread.h"
// Return true if the given child is dead. This will also reap the process.
// Doesn't block.
static bool IsChildDead(pid_t child) {
- const int result = waitpid(child, NULL, WNOHANG);
+ const int result = HANDLE_EINTR(waitpid(child, NULL, WNOHANG));
if (result == -1) {
NOTREACHED();
} else if (result > 0) {
@@ -52,10 +53,7 @@ class BackgroundReaper : public PlatformThread::Delegate {
if (kill(child_, SIGKILL) == 0) {
// SIGKILL is uncatchable. Since the signal was delivered, we can
// just wait for the process to die now in a blocking manner.
- int result;
- do {
- result = waitpid(child_, NULL, 0);
- } while (result == -1 && errno == EINTR);
+ HANDLE_EINTR(waitpid(child_, NULL, 0));
} else {
LOG(ERROR) << "While waiting for " << child_ << " to terminate we"
<< " failed to deliver a SIGKILL signal (" << errno << ").";
« no previous file with comments | « chrome/common/ipc_send_fds_test.cc ('k') | chrome/common/transport_dib_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698