<i>Nested mutexes following TIP 509</i> status still Closed with 5 other changes
by
.
D 2025-09-26T12:39:31.472
J closedate 2460945.02744759
J closer chw
J icomment >\s...\sthe\sreason\swhy\sthe\sdouble\schecked\slocking\schecks\sfor\sthe\svalue\s**again**\r\n>\safter\sobtaining\sthe\slock\sand\sdoes\snot\srely\son\sthe\spreceding\scheck.\r\n\r\nAshok,\sand\shere\swe\sare\sagain.\sLet\sus\sread\scarefully\sthe\sbeginnings\sof\r\nthe\srecursive\smutexing\smystery\s(POSIX\swithout\snative\srecursive\ssupport):\r\n\r\n\s\s/*\sunlocked\sinitial\stest\s*/\r\n\s\sif\s(currentthread\s!=\sowningthread\s||\scounter\s==\s0)\s{\r\n\s\s\s\s\s\spthread_mutex_lock(mutex)\r\n\s\s/*\s...\s*/\r\n\r\nowningthread\scan\sbe\sPTHREAD_NULL\sor\sa\sthread\sidentifier.\sIf\sit\swere\r\nthe\scurrent\sthread,\sthe\scounter\sshould\sbe\sgreater\sthan\szero,\selse\r\nthe\sRAM\sand\scaches\swould\sbe\sbollocks.\sOtherwise\sand\sall\selse\sthe\smutex\r\n*must*\sbe\slocked.\sAnd\smemory\s*must*\sbe\sconsistent\sthen\sand\swe\sinitialize\r\nall\srespective\smemory\sto\sa\swell\sknown\sstate.\r\n\r\nMy\sconclusion\safter\sall\sis\sthat\swe\sare\sin\sthe\sprocess\sof\sfull\sspectrum\r\noverengineering.\r\n\r\nMoreover,\sthis\s*must*\sbe\sthe\ssame\swith\sWin32\sCRITICIAL_SECTION,\si.e.\r\nthe\smutex\sentry\smust\simply\ssome\skind\sof\smemory\sbarrier,\sfence\sor\show\r\nit\smight\sbe\snamed\sin\sthe\sjargon\sof\sthe\sprocessor\sarchitecture.\r\n\r\nEven\smore\sdid\sI\sprove\swith\sthe\saccepted\sTIP#511,\sthat\srecursive\r\nmutexen\sadd\szero\svalue\sto\sthe\sPOSIX\ssignals\sprocess\sversus\sthreads\r\ndilemma.\sAnd\swas\sin\sthe\syear\sof\s2018\salready\sstrongly\sagainst\sthose\r\nrecursive\smutexes.\r\n\r\nSo\splease\sditch\sit.\sUltimately.\sAnd\smaybe\skeep\sfor\sthe\sboneheads\ssome\r\nalternative\sinterface.\sMaybe\scalling\sit\seven\r\n\r\n\sTcl_RecursiveMutex(Unl|L)ockForTheBoneheads()\r\n\r\nwith\san\sexplicit\sstatement\sin\sthe\sdocumentation\sthat\sthis\skind\sof\r\nidiotsyncrazy\sis\sa\spowder\skeg\sfor\scondition\svariables.\r\n\r\nThank\syou\sfor\syour\sattention\sto\sthis\smatter.
J login chw
J mimetype text/plain
K 893f8cc5db3ba8bd6bed80ce89a0a75c6088a37c
U chw
Z 7dff7d10adf08f6ca5b08c02dee90f2a