Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 1b66cbecfa109998112de24719e470e20fa6044b
Ticket: 525783ffffffffffffffffffffffffffffffffff
Need optional full flush on [exit] for serial
User & Date: dkf on 2002-03-06 20:18:16
Changes

  1. icomment:
    Logged In: YES 
    user_id=79902
    
    The problem with tcflush on exit is that it can nuke output
    in the OS buffers that came from stderr (say "sayonara" to
    debugging messages!)  Further investigation found that this
    could still happen even with some fairly elaborate measures
    to prevent it (like barring tcflush from operating on FDs 0,
    1 and 2) because it is a race between the data being grabbed
    by the tty and displayed, and the tcflush on an unrelated
    channel (you'll need the [open [exec tty]] addition
    mentioned below to enable this behaviour.)
    
    So as to make sure that people just using Tcl normally would
    not see the problem, and given the short timescale we were
    working on w.r.t. the 8.4a4 release, the tcflush was changed
    to a tcdrain (whose behaviour meets more what non-serial
    people think of by a flush!) even though this is clearly not
    what you were intending when you wrote the code.  A better
    fix will require application-input (since both behaviours
    are right in certain circumstances) which means there's room
    for another thing to [fconfigure], e.g.
    
       fconfigure $fd -onclose wait/discard
    
    (Reset semantics probably ought to be handled in the same
    way, because they are equally surprising when they hit the
    controlling terminal and both styles of behaviour can be
    considered to be correct in some circumstances.)
    
    
  2. login: "dkf"
  3. mimetype: "text/plain"
  4. username: "dkf"