Tcl Source Code

Artifact [d7c29bf289]
Login

Artifact d7c29bf28904f84ce7465846233924d2fd2235a7:

Attachment "fcopy-async.patch" to ticket [1932639fff] added by ferrieux 2008-04-03 05:02:41.
--- tcl8.5.1-orig/generic/tclIO.c	Sun Jan 20 21:16:15 2008
+++ tcl8.5.1/generic/tclIO.c	Wed Apr  2 21:49:38 2008
@@ -8578,6 +8578,18 @@
 	    goto writeError;
 	}
 
+
+	if (cmdPtr && (mask == 0))
+	    {
+		/*
+		 * In async mode, skip reading in sync part
+		 * Also, fake an underflow to prime the readable fileevent
+		 */
+		size=0;
+		underflow=1;
+	    }
+	else
+	    {
 	/*
 	 * Read up to bufSize bytes.
 	 */
@@ -8595,7 +8607,7 @@
 		    0 /* No append */);
 	}
 	underflow = (size >= 0) && (size < sizeb);	/* Input underflow */
-
+	    }
 	if (size < 0) {
 	readError:
 	    if (interp) {
@@ -8731,7 +8743,7 @@
 	 * don't starve the rest of the system.
 	 */
 
-	if (cmdPtr) {
+	if (cmdPtr &&(csPtr->toRead != 0)) {
 	    /*
 	     * The first time we enter this code, there won't be a channel
 	     * handler established yet, so do it here.
@@ -8760,6 +8772,8 @@
      */
 
     total = csPtr->total;
+
+
     if (cmdPtr && interp) {
 	int code;
 	/*