Tcl package Thread source code

Ticket Change Details
Login
Overview

Artifact ID: 53ff16fbd770d850789c73015410303304fc2a8a6144d6cbb6ec9529cb2d593d
Ticket: c6057948e5f884435ee35517008db0205f286a5e
tsv commands break thread access rules for Tcl values
User & Date: dgp 2018-03-29 23:02:20
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    Multi-thread access to a Tcl_Obj struct is at best perilous
    because the Tcl_IncrRefCount and Tcl_DecrRefCount public
    routines are not routines at all, but macros.
    
    And they are macros written with the strong assumption that
    while they operate the caller has exclusive access to the field.
    The only safe approach is to follow a strict rule that any
    Tcl_Obj is accessed by only a single thread that can be said
    to "own" that value. If you need to pass a value from one thread
    to another, you need to have the second thread create its own
    copy of the first, quite possibly limited only to the mechanism
    of making a full copy of the string rep.
    
    These rules are checked by the Tcl core when the --enable-symbols=mem
    configuration setting is on. Tcl_Obj allocation stores the allocated
    pointer in a thread-local hash map, and deallocation removes from
    the same thread-local hash map.  Some mismatches (but not all?!?!)
    are detected with a Tcl_Panic().
    
  5. is_private changed to: "0"
  6. login: "dgp"
  7. priority changed to: "5 Medium"
  8. resolution changed to: "None"
  9. severity changed to: "Critical"
  10. status changed to: "Open"
  11. submitter changed to: "dgp"
  12. subsystem changed to: "80. Thread Package"
  13. title changed to:
    tsv commands break thread access rules for Tcl values
    
  14. type changed to: "Bug"