inconsistent thread id values in testing commands
Closed / Fixed89dfecb6b7468953b2563eb6034d6a087388770eCreated 9 years agoUpdated 9 years ago
Descriptionplain2018-02-20 14:58:38
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.
Referenced by2
6b66e4e45c[89dfecb6b7] Make thread IDs in testing commands consistent. check-in2018-02-22 18:59:590a56102bb4[89dfecb6b7] Make thread IDs in testing commands consistent. check-in2018-02-22 18:57:20
dgp Closed ticket [89dfecb6b7].
[History diff]2018-02-22 19:04:06
Log in (anonymous is fine) to add a comment.