Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6ff6850a3284c45f316de634ff0cb3577671f12c784289afb153e071b01c6512
Ticket: de232b49f26da1c18e07513d4c7caa203cd27910
write-only nonblocking refchan and Tcl internal buffers
User & Date: pooryorick on 2024-04-02 10:26:35
Changes

  1. icomment:
    TLDR:  If you can find an acceptable way to eliminate that timer, then
    I'm all for it.  Just don't revert this change wholesale.  The situation
    calls for more effort than that.
    
    Next...
    
    I understand all of the principles that you've explained, and in theory
    agree.  The thing is that Tcl provides a variety of knobs to achieve
    various behaviours, and also provides refchans, which must function even
    in the absence of external state changes that typical channels have.
    You're arguing from a matter or principle, but the trick is to
    accommodate all of these behaviours and contexts in practice.  If you
    can eliminate that timer without breaking anything, than please do!
    What I'm arguing against is just reverting this change without providing
    any other fix, and without even providing an example of something that
    is broken and can't be fixed by any of the existing knobs.  I have shown
    how to asynchronously connected by using <code>[socket -async]</code>
    and not configuring the channel as nonblocking until the "connected"
    event is handled. No one has made test io-14.11.0 reliably fail in the
    error case, so it's currently not a meaningful test.  The idle queue
    starvation you mentioned was easily fixable separately.  Until there is
    a concrete example showing something that needs fixing, the best way to
    continue is for any interested party to make improvements to existing
    code, and not to revert the change that fixed this issue.
    
    I'm not fond of that timer either, and I've even provided an idea for
    taking steps towards eliminating it.  Perhaps that got lost in the
    noise:  The timer can be constrained to cases where a write (perhaps
    only to a buffer) has already occurred and an unfilled buffer exists.
    This would move things in the direction you're advocating by only
    employing the timer when it is really necessary.  If you have time, you
    could do that work, or I'll do it when I have time, or maybe someone
    will come up with a way to eliminate the timer entirely.  Let's work on
    it, and not just revert changes that have been in place for four years
    already, and that do solve issues like the one described in the current
    report.
    
    All a refchan should have to do is use [chan postevent] to indicate that
    it is writable.  Yes, refchans currently set up timers keep those
    writable events posting, but as you've just elegantly explained, that's
    a bad hack that violates the principles of asynchronous channels.  So
    let's not enshrine that in the design, but instead get to work on the
    internals so that things remain simple at the script level, and we can
    continue to improve the situation in the implementation as intelligence
    and time resources become available.
    
  2. login: "pooryorick"
  3. mimetype: "text/x-fossil-wiki"