Tcl Source Code

Check-in [8cf00e79f5]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:merge 8.5; fix notifier mask bug and Tcl_Read performance regression
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8cf00e79f574aea371aaf911c15a67cb904ccfc5
User & Date: dgp 2014-08-22 13:48:50
Context
2014-08-25
15:40
merge-mark check-in: 7fb1988d33 user: dgp tags: trunk
2014-08-24
17:59
merge trunk check-in: ee7c5a97be user: dgp tags: dgp-refactor
17:50
merge trunk check-in: 83d073e6c1 user: dgp tags: novem
2014-08-22
17:28
merge trunk; stamp release date. check-in: c8daa1083d user: dgp tags: rc2, core-8-6-2-rc
13:48
merge 8.5; fix notifier mask bug and Tcl_Read performance regression check-in: 8cf00e79f5 user: dgp tags: trunk
13:23
Correct performance regression in a series of short binary reads from a socket. Many thanks to Eric... check-in: 70e97884f0 user: dgp tags: core-8-5-branch
2014-08-20
11:23
[74e073599e]: tclsh is using old style dialogs when Tk is l... check-in: c438e5f6a0 user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclIO.c.

8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
	/*
	 * If this channel handler is interested in any of the events that
	 * have occurred on the channel, invoke its procedure.
	 */

	if ((chPtr->mask & mask) != 0) {
	    nh.nextHandlerPtr = chPtr->nextPtr;
	    chPtr->proc(chPtr->clientData, mask);
	    chPtr = nh.nextHandlerPtr;
	} else {
	    chPtr = chPtr->nextPtr;
	}
    }

    /*







|







8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
	/*
	 * If this channel handler is interested in any of the events that
	 * have occurred on the channel, invoke its procedure.
	 */

	if ((chPtr->mask & mask) != 0) {
	    nh.nextHandlerPtr = chPtr->nextPtr;
	    chPtr->proc(chPtr->clientData, chPtr->mask & mask);
	    chPtr = nh.nextHandlerPtr;
	} else {
	    chPtr = chPtr->nextPtr;
	}
    }

    /*
9509
9510
9511
9512
9513
9514
9515

9516
9517
9518
9519

9520

9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
	 */

	if (statePtr->flags & CHANNEL_EOF
		&& (bufPtr == NULL || IsBufferEmpty(bufPtr))) {
	    break;
	}


	/* If there is no full buffer, attempt to create and/or fill one. */

	while (!IsBufferFull(bufPtr)) {
	    int code;



	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) {
		/* Read error */
		UpdateInterest(chanPtr);
		TclChannelRelease((Tcl_Channel)chanPtr);
		return -1;
	    }

	    assert (IsBufferFull(bufPtr));
	}

	assert (bufPtr != NULL);

	bytesRead = BytesLeft(bufPtr);
	bytesWritten = bytesToRead;

	TranslateInputEOL(statePtr, p, RemovePoint(bufPtr),
		&bytesWritten, &bytesRead);
	bufPtr->nextRemoved += bytesRead;
	p += bytesWritten;







>
|
|
<
<
>

>

|
<
<
<
<
<
<
<
<
<
<





|
<


<
<







9509
9510
9511
9512
9513
9514
9515
9516
9517
9518


9519
9520
9521
9522
9523










9524
9525
9526
9527
9528
9529

9530
9531


9532
9533
9534
9535
9536
9537
9538
	 */

	if (statePtr->flags & CHANNEL_EOF
		&& (bufPtr == NULL || IsBufferEmpty(bufPtr))) {
	    break;
	}

	/*
	 * 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:
	    if (GetInput(chanPtr)) {










		/* Read error */
		UpdateInterest(chanPtr);
		TclChannelRelease((Tcl_Channel)chanPtr);
		return -1;
	    }
	    bufPtr = statePtr->inQueueHead;

	}



	bytesRead = BytesLeft(bufPtr);
	bytesWritten = bytesToRead;

	TranslateInputEOL(statePtr, p, RemovePoint(bufPtr),
		&bytesWritten, &bytesRead);
	bufPtr->nextRemoved += bytesRead;
	p += bytesWritten;

Changes to tests/io.test.

4946
4947
4948
4949
4950
4951
4952


4953

4954
4955
4956
4957
4958
4959
4960
    lappend x [fblocked $f1]
    close $f1
    set x
} {{} 1 hello 0 {} 1}
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}

    flush $f1
    gets $f1
    fconfigure $f1 -blocking off -buffering full
    puts $f1 {puts hello}
    set x ""
    lappend x [gets $f1]
    lappend x [fblocked $f1]







>
>
|
>







4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
    lappend x [fblocked $f1]
    close $f1
    set x
} {{} 1 hello 0 {} 1}
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 {
	chan configure stdout -encoding binary -translation lf -eofchar {}
	puts hello_from_pipe
    }
    flush $f1
    gets $f1
    fconfigure $f1 -blocking off -buffering full
    puts $f1 {puts hello}
    set x ""
    lappend x [gets $f1]
    lappend x [fblocked $f1]