Overview
| Artifact ID: | ca33ac9bf95c433e2c1acc83d1058fb5137502a5ffd693d3807190c18110f96c |
|---|---|
| Ticket: | 893f8cc5db3ba8bd6bed80ce89a0a75c6088a37c
Nested mutexes following TIP 509 |
| User & Date: | sebres on 2025-09-27 21:16:39 |
Changes
- closedate changed to: "2460946.3865648"
- closer changed to: "sebres"
- icomment:
Well, I still hope we'd revert everything to pre TIP 509 and provide that as an extra API (if needed at all). Regarding [6c6604aee18eae14], are not there some typos - `#ifndef NDEBUG` vs `#ifdef NDEBUG` (some panics are in debug another vice versa)? Another thing - if debug only, why cannot it be simple rewritten as an assert instead? As for Christians statement, I guess he meant the initial variant without atomic stuff completely, so one'd "speculate" that the thread/counter vars going changed in lock only and read operations on them are either safe without lock, or happen atomically (again, speculating they are properly aligned, access not reordered by compiler, etc). My opinion is that interlocking makes it more robust and may prevent against some UBs in certain circumstances (e. g. compiled there, where pointer to Tcl_Mutex gets not properly aligned, so read cannot happen atomic, because high and lower words becomes read separately). But... My objections have orthogonal nature either and goes to the reentrant mutexes as such. Like associated with it extra overhead, cache washouts, additional sensibility to memory fragmentation, especially by "neglecting" of CPU cache granularity (which was always there due to thread-alloc, but with reentrant mutexes becomes worse)... Everything that what is influenced by new vars and totally unneeded in Tcl-core in all general facilities, currently protected by Tcl_Mutex.<br/> To this day, no one has explained to me why a feature was implemented this way and not as new API. Getting ahead of the game, the hypothetic argument that this will immediately "fix" the existing code (using Tcl_Mutex but theoretically implying recursion) is not an argument at all, IMHO.
- login: "sebres"
- mimetype: "text/x-fossil-wiki"