>>>> "APA" == Adrian Aichner
APA> What about the windows platform?
OK, I couldn't resist the challenge, and took a look.
APA> Should a similar change be applied there too?
It's already in process-nt.c, except that there's a duration doubling
loop (starting at 25ms with a maximum period of 1s). Does anybody
know whether this is a good idea? I suppose the idea is to avoid
polling every 25ms if the process is actually producing output only at
1s intervals, but it's not obvious to me that this really is a huge
Here's a patch for process-unix.c that incorporates this idea, for the
sake of discussion. (The differences with process-nt.c are that this
starts at 10ms, and the NT code doesn't need to fiddle with the
SIGPIPE handler, so it's actually much simpler.)
diff --git a/src/process-unix.c b/src/process-unix.c
index e0e64ed..121a7b8 100644
＠＠ -1543,20 +1543,25 ＠＠ unix_send_process (Lisp_Object proc, str
Lstream_flush (XLSTREAM (DATA_OUTSTREAM(p)));
EMACS_SIGNAL (SIGPIPE, old_sigpipe);
- while (Lstream_was_blocked_p (XLSTREAM (p->pipe_outstream)))
- /* Buffer is full. Wait, accepting input;
- that may allow the program
- to finish doing output and read more. */
- Faccept_process_output (Qnil, make_int (1), Qnil);
- /* It could have *really* finished, deleting the process */
- if (NILP(p->pipe_outstream))
- old_sigpipe =
- (SIGTYPE (*) (int)) EMACS_SIGNAL (SIGPIPE, send_process_trap);
- Lstream_flush (XLSTREAM (p->pipe_outstream));
- EMACS_SIGNAL (SIGPIPE, old_sigpipe);
+ int wait_ms = 10;
+ while (Lstream_was_blocked_p (XLSTREAM (p->pipe_outstream)))
+ /* Buffer is full. Wait a bit, accepting input; that may
+ allow the program to finish doing output and read more.
+ Used to be 1s, but that's excruciatingly slow.
+ N.B. timeout_secs = Qnil is faster than Qzero. */
+ Faccept_process_output (Qnil, Qnil, make_int (wait_ms));
+ /* It could have *really* finished, deleting the process */
+ if (NILP(p->pipe_outstream))
+ old_sigpipe =
+ (SIGTYPE (*) (int)) EMACS_SIGNAL (SIGPIPE, send_process_trap);
+ Lstream_flush (XLSTREAM (p->pipe_outstream));
+ EMACS_SIGNAL (SIGPIPE, old_sigpipe);
+ wait_ms = min (1000, 2 * wait_ms);
/* Perhaps should ABORT() if < 0? This should never happen. */
while (chunklen > 0);
diff --git a/src/ChangeLog b/src/ChangeLog
index fce3389..0ba6a97 100644
＠＠ -1,3 +1,13 ＠＠
+2006-03-23 Stephen J. Turnbull <stephen(a)xemacs.org>
+ * process-unix.c (unix_send_process): Follow process-nt here, and
+ use an increasing timeout (up to 1s).
+2006-03-23 Tony Bennett <tbennett(a)nvidia.com>
+ * process-unix.c (unix_send_process): Reduce timeout in
+ Faccept_process_output to 10ms.
2006-03-20 Marcus Crestani <crestani(a)xemacs.org>
* dynarr.c (Dynarr_realloc): Malloc correct size.
School of Systems and Information Engineering http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.