Diff
Not logged in

Differences From Artifact [9128d89429]:

To Artifact [fe73f3304c]:


1010
1011
1012
1013
1014
1015
1016
1017
1018
1019




1020







1021


1022
1023
1024
1025
1026
1027
1028
1010
1011
1012
1013
1014
1015
1016



1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028

1029
1030
1031
1032
1033
1034
1035
1036
1037







-
-
-
+
+
+
+

+
+
+
+
+
+
+
-
+
+







    if (handleInfoPtr) {
	/*
	 * Console thread may be blocked either waiting for console i/o
	 * or waiting on the condition variable for buffer empty/full
	 */
	AcquireSRWLockShared(&handleInfoPtr->lock);

	handleInfoPtr->numRefs -= 1; /* Remove reference from this channel */
	handleInfoPtr->console = INVALID_HANDLE_VALUE;

	if (closeHandle) {
	    handleInfoPtr->console = INVALID_HANDLE_VALUE;
	}

	/* Break the thread out of blocking console i/o */
	handleInfoPtr->numRefs -= 1; /* Remove reference from this channel */
	if (handleInfoPtr->numRefs == 1) {
	    /*
	     * Abort the i/o if no other threads are listening on it.
	     * Note without this check, an input line will be skipped on
	     * the cancel.
	     */
	CancelSynchronousIo(handleInfoPtr->consoleThread);
	    CancelSynchronousIo(handleInfoPtr->consoleThread);
	}

	/*
	 * Wake up the console handling thread. Note we do not explicitly
	 * tell it handle is closed (below). It will find out on next access
	 */
	WakeConditionVariable(&handleInfoPtr->consoleThreadCV);

1109
1110
1111
1112
1113
1114
1115



1116


1117
1118
1119
1120
1121
1122
1123
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127

1128
1129
1130
1131
1132
1133
1134
1135
1136







+
+
+
-
+
+







	numRead = RingBufferOut(&handleInfoPtr->buffer, bufPtr, bufSize, 1);
	/*
	 * Note: even if channel is closed or has an error, as long there is
	 * buffered data, we will pass it up.
	 */
	if (numRead != 0) {
	    /* If console thread was blocked, awaken it */
	    if (chanInfoPtr->flags & CONSOLE_ASYNC) {
		/* Async channels always want read ahead */
		handleInfoPtr->flags |= CONSOLE_DATA_AWAITED;
	    // XXX WakeConditionVariable(&handleInfoPtr->consoleThreadCV);
		WakeConditionVariable(&handleInfoPtr->consoleThreadCV);
	    }
	    break;
	}
	/*
	 * No data available.
	 *  - If an error was recorded, generate that and reset it.
	 *  - If EOF, indicate as much. It is up to the application to close
	 *    the channel.
1163
1164
1165
1166
1167
1168
1169





1170
1171
1172
1173
1174
1175
1176
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194







+
+
+
+
+







	    Tcl_WinConvertError(GetLastError());
	    *errorCode = Tcl_GetErrno();
	    numRead = -1;
	    break;
	}
	/* Lock is reacquired, loop back to try again */
    }
    if (chanInfoPtr->flags & CONSOLE_ASYNC) {
	/* Async channels always want read ahead */
	handleInfoPtr->flags |= CONSOLE_DATA_AWAITED;
	WakeConditionVariable(&handleInfoPtr->consoleThreadCV);
    }

    ReleaseSRWLockExclusive(&handleInfoPtr->lock);
    return numRead;
}

/*
 *----------------------------------------------------------------------
2182
2183
2184
2185
2186
2187
2188

2189

2190
2191

2192
2193
2194

2195
2196
2197
2198
2199
2200
2201
2200
2201
2202
2203
2204
2205
2206
2207

2208
2209

2210
2211
2212

2213
2214
2215
2216
2217
2218
2219
2220







+
-
+

-
+


-
+







		Tcl_SetObjResult(interp, Tcl_ObjPrintf(
			"couldn't read console mode: %s",
			Tcl_PosixError(interp)));
	    }
	    return TCL_ERROR;
	}
	if (Tcl_UtfNcasecmp(value, "NORMAL", vlen) == 0) {
	    mode |=
	    mode |= ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT;
		ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT;
	} else if (Tcl_UtfNcasecmp(value, "PASSWORD", vlen) == 0) {
	    mode |= ENABLE_LINE_INPUT;
	    mode |= ENABLE_LINE_INPUT|ENABLE_PROCESSED_INPUT;
	    mode &= ~ENABLE_ECHO_INPUT;
	} else if (Tcl_UtfNcasecmp(value, "RAW", vlen) == 0) {
	    mode &= ~(ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT);
	    mode &= ~(ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT);
	} else if (Tcl_UtfNcasecmp(value, "RESET", vlen) == 0) {
	    /*
	     * Reset to the initial mode, whatever that is.
	     */
	    mode = chanInfoPtr->initMode;
	} else {
	    if (interp) {