Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 445d87fd306ce2d255c3619c8143b7d3c51d58f5
Ticket: 894da183c8475264b8070b5b4dbbd6dd72f8dd69
In a thread, switch a non-blocking channel to blocking and close == hang
User & Date: pooryorick on 2015-04-26 01:18:33
Changes

  1. icomment:
    Some experimentation showed that in case of the first example (no [flush
    $chan]), the contents of In tclIO.c/FlushChannl, the contents of
    statePtr->curOutPtr were not getting flushed, causing FlushChannel not to call
    CloseChannel.   This fix solves the problem and passes the Tcl test suite:
    
    <code><verbatim>
    --- tclIO.c
    +++ tclIO.c
    @@ -2653,12 +2653,14 @@
          * can be written to it, possibly filling it, to promote more efficient
          * buffer usage.
          */
     
         bufPtr = statePtr->curOutPtr;
    +
         if (bufPtr && BytesLeft(bufPtr) && /* Keep empties off queue */
    -           (statePtr->outQueueHead == NULL || IsBufferFull(bufPtr))) {
    +           (statePtr->outQueueHead == NULL || IsBufferFull(bufPtr)
    +           || GotFlag(statePtr ,CHANNEL_CLOSED))) {
            if (statePtr->outQueueHead == NULL) {
                statePtr->outQueueHead = bufPtr;
            } else {
                statePtr->outQueueTail->nextPtr = bufPtr;
            }
    </verbatim></code>
    
  2. login: "pooryorick"
  3. mimetype: "text/x-fossil-wiki"
  4. username: "pooryorick"