Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 542f2034485c50ca094010b89b2736ca07fbe291
Ticket: 2826430fffffffffffffffffffffffffffffffff
Channel name recycling is dangerous
User & Date: coldstore on 2009-07-24 16:55:14
Changes

  1. icomment:
    To clarify, per Alexandre's request:  if you have a coro which is in the process of handling fileevents on a socket (socket10, let's say) and you decide you want to not handle events on that socket for a few seconds, so you schedule an [after] event to trigger to enable you to re-establish the [fileevent $sock] ... you must store the socket name (socket10) in the variable sock, which may be a coro variable, hence inaccessible to other coros.  If a different processing stream, or coro, decides it wants to close socket10, it can't safely do that until and unless it has notified the 
    first coro of its intention, so that it can forget about socket10 - cancel any [after] events it may have scheduled.
    
    If this sounds like a contrived example, it's not.  I have almost exactly this problem in adding input throttling to Wub right now, and anyone writing a producer/consumer pair with buffering where the two parts make use of modern Tcl facilities such as coros or [apply] or even [interp] will have similar problems.  The amount of data which needs to 
    be shared between the distinct processing elements is too great, and is imposed entirely by the rapid cycling of chan names.
    
    It is true that one could fix the cycling, but the idea of encoding names with significant information also appeals to me, and comes for free with this fix.
    
    
    
  2. login: "coldstore"
  3. mimetype: "text/plain"
  4. username: "coldstore"