<i>Nested mutexes following TIP 509</i> status still Closed with 5 other changes
by
.
D 2025-09-27T21:16:39.199
J closedate 2460946.3865648
J closer sebres
J icomment Well,\sI\sstill\shope\swe'd\srevert\severything\sto\spre\sTIP\s509\sand\sprovide\sthat\sas\san\sextra\sAPI\s(if\sneeded\sat\sall).\r\n\r\nRegarding\s[6c6604aee18eae14],\sare\snot\sthere\ssome\stypos\s-\s`#ifndef\sNDEBUG`\svs\s`#ifdef\sNDEBUG`\s(some\spanics\sare\sin\sdebug\sanother\svice\sversa)?\r\nAnother\sthing\s-\sif\sdebug\sonly,\swhy\scannot\sit\sbe\ssimple\srewritten\sas\san\sassert\sinstead?\r\n\r\nAs\sfor\sChristians\sstatement,\sI\sguess\she\smeant\sthe\sinitial\svariant\swithout\satomic\sstuff\scompletely,\sso\sone'd\s"speculate"\sthat\sthe\sthread/counter\svars\sgoing\schanged\sin\slock\sonly\sand\sread\soperations\son\sthem\sare\seither\ssafe\swithout\slock,\sor\shappen\satomically\s(again,\sspeculating\sthey\sare\sproperly\saligned,\saccess\snot\sreordered\sby\scompiler,\setc).\sMy\sopinion\sis\sthat\sinterlocking\smakes\sit\smore\srobust\sand\smay\sprevent\sagainst\ssome\sUBs\sin\scertain\scircumstances\s(e.\sg.\scompiled\sthere,\swhere\spointer\sto\sTcl_Mutex\sgets\snot\sproperly\saligned,\sso\sread\scannot\shappen\satomic,\sbecause\shigh\sand\slower\swords\sbecomes\sread\sseparately).\sBut...\r\n\r\nMy\sobjections\shave\sorthogonal\snature\seither\sand\sgoes\sto\sthe\sreentrant\smutexes\sas\ssuch.\sLike\sassociated\swith\sit\sextra\soverhead,\scache\swashouts,\sadditional\ssensibility\sto\smemory\sfragmentation,\sespecially\sby\s"neglecting"\sof\sCPU\scache\sgranularity\s(which\swas\salways\sthere\sdue\sto\sthread-alloc,\sbut\swith\sreentrant\smutexes\sbecomes\sworse)...\sEverything\sthat\swhat\sis\sinfluenced\sby\snew\svars\sand\stotally\sunneeded\sin\sTcl-core\sin\sall\sgeneral\sfacilities,\scurrently\sprotected\sby\sTcl_Mutex.<br/>\r\nTo\sthis\sday,\sno\sone\shas\sexplained\sto\sme\swhy\sa\sfeature\swas\simplemented\sthis\sway\sand\snot\sas\snew\sAPI.\sGetting\sahead\sof\sthe\sgame,\sthe\shypothetic\sargument\sthat\sthis\swill\simmediately\s"fix"\sthe\sexisting\scode\s(using\sTcl_Mutex\sbut\stheoretically\simplying\srecursion)\sis\snot\san\sargument\sat\sall,\sIMHO.
J login sebres
J mimetype text/x-fossil-wiki
K 893f8cc5db3ba8bd6bed80ce89a0a75c6088a37c
U sebres
Z addaf56a02170851aee21d37eb4b6088