Manifest of check-in
[f924c2f8e3]
- PTHREAD_NULL is not _actually_ a valid pthread_t, and should not
be supplied as an argument to pthread_*() functions.
On NetBSD, Tcl was faulting at
[PMutexDestroy()](/home/file?ci=e29c5206a97aa935207e1b21d33ca&name=unix/tclUnixThrd.c&ln=92)
in the assertion, which failed because PTHREAD_NULL is not actually
a valid thread identifier, did not satisfy the intention what was
trying to be asserted. pthread_t is an opaque type. On NetBSD (for
example) it is a structure, with magic for sanity checks.
"(pthread_t)0" does not pass this test when (e.g.) pthread_equal(t1,
t2) is called. I changed tests for PTHREAD_NULL to simple equality
checks (e.g. PTHREAD_NULL == pmutexPtr->thread), and guarded with
the same test pthread_*() calls where appropriate (those function
calls involving pmutexPtr->thread).
by
bch on
2026-05-23 02:16:41.
B e29c5206a97aa935207e1b21d33cafe361bc6123c1ff58dc749d97b74c437f9b
C PTHREAD_NULL\sis\snot\s_actually_\sa\svalid\spthread_t,\sand\sshould\snot\nbe\ssupplied\sas\san\sargument\sto\spthread_*()\sfunctions.\n\nOn\sNetBSD,\sTcl\swas\sfaulting\sat\n\s\s[PMutexDestroy()](/home/file?ci=e29c5206a97aa935207e1b21d33ca&name=unix/tclUnixThrd.c&ln=92)\n\nin\sthe\sassertion,\swhich\sfailed\sbecause\sPTHREAD_NULL\sis\snot\sactually\na\svalid\sthread\sidentifier,\sdid\snot\ssatisfy\sthe\sintention\swhat\swas\ntrying\sto\sbe\sasserted.\spthread_t\sis\san\sopaque\stype.\sOn\sNetBSD\s(for\nexample)\sit\sis\sa\sstructure,\swith\smagic\sfor\ssanity\schecks.\n"(pthread_t)0"\sdoes\snot\spass\sthis\stest\swhen\s(e.g.)\spthread_equal(t1,\nt2)\sis\scalled.\sI\schanged\stests\sfor\sPTHREAD_NULL\sto\ssimple\sequality\nchecks\s(e.g.\sPTHREAD_NULL\s==\spmutexPtr->thread),\sand\sguarded\swith\nthe\ssame\stest\spthread_*()\scalls\swhere\sappropriate\s(those\sfunction\ncalls\sinvolving\spmutexPtr->thread).
D 2026-05-23T02:16:41.686
F unix/tclUnixThrd.c e9da644e8a0f61ecbc457ce4f70868130d2a6ed40c69ef8be889552642bacdae
P e29c5206a97aa935207e1b21d33cafe361bc6123c1ff58dc749d97b74c437f9b
R 891dfa7532417098b4d0b36db3e63515
T *branch * PTHREAD_NULL_handler
T *sym-PTHREAD_NULL_handler *
T -sym-main *
T -sym-trunk *
U bch
Z 49806b4edb4ecf70e502953e068bfd70