NOTE: This patch has been committed.
lib-src/ChangeLog addition:
2004-12-06 Ben Wing <ben(a)xemacs.org>
* i.c (pump):
Undo change of 2003-03-06. It causes truncation of output at the end.
build source patch:
Diff command: bash -ci "cvs-diff --show-c-function -no-changelog "
Files affected: lib-src/i.c
Index: lib-src/i.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lib-src/i.c,v
retrieving revision 1.4
diff -u -p -r1.4 i.c
--- lib-src/i.c 2003/03/09 02:27:28 1.4
+++ lib-src/i.c 2004/12/07 00:19:39
@@ -67,18 +67,30 @@ pump (LPVOID pv_i)
BYTE buffer [256];
DWORD really_read, unused;
- /* The docs for ReadFile claim:
+ /* I said:
+
+ [[ The docs for ReadFile claim:
The ReadFile function returns when one of the following is true: a write
operation completes on the write end of the pipe, the number of bytes
requested has been read, or an error occurs.
But this is just not true. ReadFile never seems to block, and unless we
- Sleep(), we will chew up all the CPU time. --ben
- */
+ Sleep(), we will chew up all the CPU time. --ben ]]
+
+ But in fact
+
+ [a] this does not appear to be the case any more [maybe a temporary
+ bug in some versions of Win2000?]
+ [b] it causes data lossage. [#### Why should this be? Seems extremely
+ fishy. I tried commenting out the calls to close the standard
+ handles at the bottom of the program, but it made no difference.
+ Would we need some kind of additional handshaking? If we get
+ data loss with the sleep, then we are a race condition waiting
+ to happen. */
while (ReadFile (pi->source, buffer, sizeof (buffer), &really_read, NULL)
&&
WriteFile (pi->drain, buffer, really_read, &unused, NULL))
- Sleep (100);
+ /* Sleep (100) */ ;
return 0;
}
Show replies by date