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

Side by Side Diff: chrome/common/process_watcher_posix.cc

Issue 340046: Use HANDLE_EINTR when calling waitpid (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/process_watcher.h" 5 #include "chrome/common/process_watcher.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <signal.h> 8 #include <signal.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <sys/wait.h> 10 #include <sys/wait.h>
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 37
38 void ThreadMain() { 38 void ThreadMain() {
39 WaitForChildToDie(); 39 WaitForChildToDie();
40 delete this; 40 delete this;
41 } 41 }
42 42
43 void WaitForChildToDie() { 43 void WaitForChildToDie() {
44 // Wait forever case. 44 // Wait forever case.
45 if (timeout_ == 0) { 45 if (timeout_ == 0) {
46 pid_t r = waitpid(child_, NULL, 0); 46 pid_t r = HANDLE_EINTR(waitpid(child_, NULL, 0));
47 if (r != child_) { 47 if (r != child_) {
48 LOG(ERROR) << "While waiting for " << child_ 48 LOG(ERROR) << "While waiting for " << child_
49 << " to terminate, we got the following result: " << r; 49 << " to terminate, we got the following result: " << r;
50 } 50 }
51 return; 51 return;
52 } 52 }
53 53
54 // There's no good way to wait for a specific child to exit in a timed 54 // There's no good way to wait for a specific child to exit in a timed
55 // fashion. (No kqueue on Linux), so we just loop and sleep. 55 // fashion. (No kqueue on Linux), so we just loop and sleep.
56 56
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 // static 94 // static
95 void ProcessWatcher::EnsureProcessGetsReaped(base::ProcessHandle process) { 95 void ProcessWatcher::EnsureProcessGetsReaped(base::ProcessHandle process) {
96 // If the child is already dead, then there's nothing to do 96 // If the child is already dead, then there's nothing to do
97 if (IsChildDead(process)) 97 if (IsChildDead(process))
98 return; 98 return;
99 99
100 BackgroundReaper* reaper = new BackgroundReaper(process, 0); 100 BackgroundReaper* reaper = new BackgroundReaper(process, 0);
101 PlatformThread::CreateNonJoinable(0, reaper); 101 PlatformThread::CreateNonJoinable(0, reaper);
102 } 102 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698