Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: de3940aeea532db1c7956db6ee0ccf9bc3563fa06f562ff12fe0a5c805e66c71
Ticket: 89dfecb6b7468953b2563eb6034d6a087388770e
inconsistent thread id values in testing commands
User & Date: dgp on 2018-02-20 14:58:38
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    Tcl itself does not expose thread IDs to scripts.
    
    The Thread package does, and does so via a formatted string representation
    
        tid0xHHHH...
    
    where the HHHH is a hex encoding of a pointer value.
    
    Tcl does have some testing commands that expose thread IDs as
    Tcl values:
    
        testmainthread, testchannel mthread, testthread create, testthread id
    
    (some other testing commands accept these values as arguments)
    
    These testing commands do not use the same value encoding that the
    Thread package does.
    
    Worse, they do not even use a fully consistent encoding among themselves.
    Some report the pointer value as a signed long, others as a signed wide,
    using decimal representation in both cases.
    
    The difference shows up only on platforms where long and wide are different,
    typically 32-bit systems.  Recent adoption of TIP 484 in 8.7a2 has
    exposed the problem as testing failures. 
    
    In particular, test chan-io-59.1 reports failure because the signed long
    representation of a thread ID pointer returned by [testmainthread] is
    not equal to the signed wide representation (new with TIP 484!) of
    the same thread ID pointer returned by [testchannel mthread].
    
    I think the best fix is to settle on the common signed wide rep
    of [testthread id] and get them all consistent.
    
    A related issue is to note that TclFormatInt() has incompatibly
    changed its function (It used to format the string rep of a signed
    long value -- now it does a signed wide value ) and all callers need
    to be checked that they are ok with that.
    
  5. foundin changed to: "8.5+"
  6. is_private changed to: "0"
  7. login: "dgp"
  8. priority changed to: "5 Medium"
  9. resolution changed to: "None"
  10. severity changed to: "Important"
  11. status changed to: "Open"
  12. submitter changed to: "dgp"
  13. subsystem changed to: "49. Threading"
  14. title changed to: "inconsistent thread id values in testing commands"
  15. type changed to: "Bug"