Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 92d555c808b5c7059586c9a15e07ed999bd81e03
Ticket: 2826430fffffffffffffffffffffffffffffffff
Channel name recycling is dangerous
User & Date: ferrieux on 2009-07-25 17:32:02
Changes

  1. icomment:
    Oh yes you're right, I forgot channel transfer. Of course the counter must be process-global, then. The ProcessGlobal API in tclUtil.c looks a bit of an overkill though; I'd simply say
    
          int Tcl_GetUnique(void)
          {
               int res;
               Tcl_MutexLock(&uniqueLock);
               res=tclUnique++;
               Tcl_MutexUnlock(&uniqueLock);
               return res;
          }
    
    Also, it might be wise to name the routine Tcl_GetUniqueChannelIndex to convey its main purpose, avoiding "dilution" with other more frequent uses, which would accelerate wrapping to MAXUINT.
    
    Re the advanced channel lifetime management you propose to expose to script level, Andreas: I agree, it would be a nifty tool, but it is orthogonal to the "uniqueness reform" I'm proposing here. Basically the reform would kill an entire category of bugs without scripter intervention. Explicit lifetime management does need the programmer's involvement, may be used by some but not all. Why not make it a separate Freq ?
    
    
    
    
  2. login: "ferrieux"
  3. mimetype: "text/plain"
  4. username: "ferrieux"