diff options
author | dgp <dgp@users.sourceforge.net> | 2014-08-22 13:48:50 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-08-22 13:48:50 (GMT) |
commit | 2b50c1447fc0d201d7afada548a16fc6cf6645ae (patch) | |
tree | 3463f73047f7b5a5451b8b7e40a7dc606997f8bf | |
parent | 08a0a8c4a05e9a2915604e90ec54b27426677f9b (diff) | |
parent | 7b2b44f56169a915474820a5d7ed5dad0016c1c2 (diff) | |
download | tcl-2b50c1447fc0d201d7afada548a16fc6cf6645ae.zip tcl-2b50c1447fc0d201d7afada548a16fc6cf6645ae.tar.gz tcl-2b50c1447fc0d201d7afada548a16fc6cf6645ae.tar.bz2 |
merge 8.5; fix notifier mask bug and Tcl_Read performance regression
-rw-r--r-- | generic/tclIO.c | 28 | ||||
-rw-r--r-- | tests/io.test | 5 |
2 files changed, 12 insertions, 21 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index 66c0be6..eaa0aeb 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -8115,7 +8115,7 @@ Tcl_NotifyChannel( if ((chPtr->mask & mask) != 0) { nh.nextHandlerPtr = chPtr->nextPtr; - chPtr->proc(chPtr->clientData, mask); + chPtr->proc(chPtr->clientData, chPtr->mask & mask); chPtr = nh.nextHandlerPtr; } else { chPtr = chPtr->nextPtr; @@ -9513,34 +9513,22 @@ DoRead( break; } - /* If there is no full buffer, attempt to create and/or fill one. */ - - while (!IsBufferFull(bufPtr)) { - int code; + /* + * If there is not enough data in the buffers to possibly + * complete the read, then go get more. + */ + if (bufPtr == NULL || BytesLeft(bufPtr) < bytesToRead) { moreData: - code = GetInput(chanPtr); - bufPtr = statePtr->inQueueHead; - - assert (bufPtr != NULL); - - if (statePtr->flags & (CHANNEL_EOF|CHANNEL_BLOCKED)) { - /* Further reads cannot do any more */ - break; - } - - if (code) { + if (GetInput(chanPtr)) { /* Read error */ UpdateInterest(chanPtr); TclChannelRelease((Tcl_Channel)chanPtr); return -1; } - - assert (IsBufferFull(bufPtr)); + bufPtr = statePtr->inQueueHead; } - assert (bufPtr != NULL); - bytesRead = BytesLeft(bufPtr); bytesWritten = bytesToRead; diff --git a/tests/io.test b/tests/io.test index cef3e81..639691a 100644 --- a/tests/io.test +++ b/tests/io.test @@ -4950,7 +4950,10 @@ test io-36.1 {Tcl_InputBlocked on nonblocking pipe} {stdio openpipe} { test io-36.1.1 {Tcl_InputBlocked on nonblocking binary pipe} {stdio openpipe} { set f1 [open "|[list [interpreter]]" r+] chan configure $f1 -encoding binary -translation lf -eofchar {} - puts $f1 {puts hello_from_pipe} + puts $f1 { + chan configure stdout -encoding binary -translation lf -eofchar {} + puts hello_from_pipe + } flush $f1 gets $f1 fconfigure $f1 -blocking off -buffering full |