Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 5c50abc1eb87286ff814525b46444d115e7c55df521f19bb3ccaaa1ab69545f0
Ticket: 17f747a4a4720f8e9797e7933dd43745b73e0e2c
Thread safety in tclZipfs.c
User & Date: sebres on 2017-11-21 14:17:40
Changes

  1. icomment:
    Sharing of Tcl_Obj between different threads is a very bad idea (and not allowed in standard tcl-core).
    And this is not necessarily a thing of atomic refCount incr/decr (resp. object modifications) - default tcl-core has neither a GIL, nor a multiple internal representation.
    
    This meant: one thread can make an integer from the object, another makes unicode string or list (with another internal representation).
    Meaning the object changes internally and this will produce a BOOM (segfaults and co.).
    
    Don't do such kind of sharing. Therefore:
    
    - either move the object completely to another thread (take over the ownership);
    - or make a duplicate (using Tcl_DuplicateObj) in order to supply it to different threads;
    - or create each time a new object by the command exec as suggested from @chw.
    
  2. login: "sebres"
  3. mimetype: "text/plain"