[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r111132: Avoid busy-waiting for child
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r111132: Avoid busy-waiting for child processes on Windows. (Bug#13086) |
Date: |
Thu, 06 Dec 2012 20:36:22 +0200 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111132
fixes bug: http://debbugs.gnu.org/13086
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Thu 2012-12-06 20:36:22 +0200
message:
Avoid busy-waiting for child processes on Windows. (Bug#13086)
src/w32proc.c (waitpid): Avoid busy-waiting when called with WNOHANG
if the child process is still running. Instead, exit the wait
loop and return zero.
modified:
src/ChangeLog
src/w32proc.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-12-06 13:48:11 +0000
+++ b/src/ChangeLog 2012-12-06 18:36:22 +0000
@@ -1,3 +1,9 @@
+2012-12-06 Eli Zaretskii <address@hidden>
+
+ * w32proc.c (waitpid): Avoid busy-waiting when called with WNOHANG
+ if the child process is still running. Instead, exit the wait
+ loop and return zero. (Bug#13086)
+
2012-12-06 Dmitry Antipov <address@hidden>
* frame.h (x_char_width, x_char_height): Remove prototypes.
=== modified file 'src/w32proc.c'
--- a/src/w32proc.c 2012-12-03 21:42:12 +0000
+++ b/src/w32proc.c 2012-12-06 18:36:22 +0000
@@ -1220,13 +1220,22 @@
{
QUIT;
active = WaitForMultipleObjects (nh, wait_hnd, FALSE, timeout_ms);
- } while (active == WAIT_TIMEOUT);
+ } while (active == WAIT_TIMEOUT && !dont_wait);
if (active == WAIT_FAILED)
{
errno = EBADF;
return -1;
}
+ else if (active == WAIT_TIMEOUT && dont_wait)
+ {
+ /* PID specifies our subprocess, but it didn't exit yet, so its
+ status is not yet available. */
+#ifdef FULL_DEBUG
+ DebPrint (("Wait: PID %d not reap yet\n", cp->pid));
+#endif
+ return 0;
+ }
else if (active >= WAIT_OBJECT_0
&& active < WAIT_OBJECT_0+MAXIMUM_WAIT_OBJECTS)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r111132: Avoid busy-waiting for child processes on Windows. (Bug#13086),
Eli Zaretskii <=