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

Unified Diff: base/process/kill_win.cc

Issue 248903002: Fix LocalTestServer shutdown on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | « base/process/kill.h ('k') | net/test/spawned_test_server/local_test_server.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/kill_win.cc
diff --git a/base/process/kill_win.cc b/base/process/kill_win.cc
index 99a7c661851c85d2fefb3d9046ffbf94e7f67852..cf099c9219057138444e197b97824e76a5738091 100644
--- a/base/process/kill_win.cc
+++ b/base/process/kill_win.cc
@@ -103,6 +103,18 @@ bool KillProcess(ProcessHandle process, int exit_code, bool wait) {
return result;
}
+bool KillJob(HANDLE job, int exit_code, bool wait) {
+ bool result = (TerminateJobObject(job, exit_code) != FALSE);
+ if (result && wait) {
+ // The processes may not end immediately due to pending I/O
Paweł Hajdan Jr. 2014/04/23 10:49:22 nit: Please end all comments with a dot.
+ if (WAIT_OBJECT_0 != WaitForSingleObject(job, 60 * 1000))
+ DLOG_GETLASTERROR(ERROR) << "Error waiting for job exit";
Paweł Hajdan Jr. 2014/04/23 10:49:22 With this wait=true is effectively a no-op in case
+ } else if (!result) {
+ DLOG_GETLASTERROR(ERROR) << "Unable to terminate job";
+ }
+ return result;
+}
+
// Attempts to kill the process identified by the given process
// entry structure, giving it the specified exit code.
// Returns true if this is successful, false otherwise.
« no previous file with comments | « base/process/kill.h ('k') | net/test/spawned_test_server/local_test_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698