Tcl Source Code

Artifact [7f4e6b9375]
Login

Artifact 7f4e6b93757c65024718dfeead1522aaf1bac400:

Attachment "asyncflush2.patch" to ticket [2946474fff] added by ferrieux 2011-08-12 06:16:45.
Index: generic/tclIO.c
===================================================================
--- generic/tclIO.c
+++ generic/tclIO.c
@@ -412,12 +412,12 @@
 	active = 0;
 	for (statePtr = tsdPtr->firstCSPtr;
 		statePtr != NULL;
 		statePtr = statePtr->nextCSPtr) {
 	    chanPtr = statePtr->topChanPtr;
-	    if (!GotFlag(statePtr, CHANNEL_INCLOSE | CHANNEL_CLOSED |
-		    CHANNEL_DEAD)) {
+	    if (!GotFlag(statePtr, CHANNEL_INCLOSE | CHANNEL_CLOSED | CHANNEL_DEAD)
+                || GotFlag(statePtr, BG_FLUSH_SCHEDULED)) {
 		active = 1;
 		break;
 	    }
 	}
 
@@ -456,10 +456,11 @@
 	    } else {
 		/*
 		 * The refcount is greater than zero, so flush the channel.
 		 */
 
+                ResetFlag(statePtr, BG_FLUSH_SCHEDULED);
 		Tcl_Flush((Tcl_Channel) chanPtr);
 
 		/*
 		 * Call the device driver to actually close the underlying
 		 * device for this channel.

Index: tests/ioCmd.test
===================================================================
--- tests/ioCmd.test
+++ tests/ioCmd.test
@@ -2590,10 +2590,11 @@
     } c]
     set res
 } -cleanup {
     rename foo {}
     unset res
+    update
 } -result {{write rc* ABC} {watch rc* write} {}} \
     -constraints {testchannel testthread}
 
 # --- === *** ###########################
 # method cgetall