Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 15831dc0150856212dd82d8e35b4d8595b602f7ef4543cbadb7e5c6e2e754b15
Ticket: 17f747a4a4720f8e9797e7933dd43745b73e0e2c
Thread safety in tclZipfs.c
User & Date: hypnotoad on 2017-11-21 12:05:46
Changes

  1. icomment:
    There was a lively discussion on stackoverflow on the subject:
    
    https://stackoverflow.com/questions/28462414/alloc-invalid-block-are-tcl-incrrefcount-and-tcl-decrrefcount-thread-safe-for
    
    The long and short answer is that Tcl_IncrRefCount is perfectly Thread safe. Passing values around between threads... no to much. Mostly to do with shimmering. 
    
    On one hand these are marked as shared objects, and anyone who was going to modify them should clone them and modify a copy. On the other... if someone does manage to modify them it will be hell to figure out what is going on.
    
    Let's meet halfway. Instead of storing Tcl_Objs, let's store constant strings. And all of the functions that return Tcl_Objs will produces a fresh copy of those strings.
    
  2. login: "hypnotoad"
  3. mimetype: "text/plain"