<i>Nested mutexes following TIP 509</i> status still Closed with 5 other changes
by
.
D 2025-09-26T16:29:41.924
J closedate 2460945.18729079
J closer chw
J icomment Ashok,\sas\sfar\sas\sI\sam\sable\sto\sremember,\sthe\sproblem\sof\sthe\r\ninitial\simplementation\sof\sthe\srecursive\smutexes\s(the\sPOSIX\r\nvariant\swithout\snative\srecursion\ssupport)\sraised\ssooner\sor\r\nlater\sthe\squestion\sabout\smemory\ssafety,\sconsistency,\sor\r\nwhatever\swe\slike\sto\sname\sit,\swhich\swas\syou\sbrought\sup\sby\syou.\r\n\r\nIn\sthe\sfollow\sup\sadditional\scode\sand\scomplexity\sto\sthe\r\nmutex\simplementation\swas\sadded.\r\n\r\nNow\sthe\sfine\spoint\sis,\sreading\s\r\n\r\nhttps://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_12\r\n\r\nthat\sconsistence\sis\sensured\swithin\sthe\scritical\sregion.\r\nThe\sreverse\sconclusion\sthus\smust\sbe:\sif\sthe\scritical\r\nregion\sis\sinitialized\s"critically"\sand\sonly\swritten\r\n"critically"\sthe\sstate\sread\sfrom\soutside\sis\ssomewhat\s\r\nconsistent,\stoo.\sAt\sleast\scan\sit\sonly\sbe\sin\stwo\r\npossible\sstates\sin\sbetween\s(thread\sidentifier\sbeing\r\nPTHREAD_NULL\sor\snot).\sAnd\sthat\sfits\stests\sof\sa\r\nthread\sidentifier\sbeing\snot\sequal\sto\ssome\sother\sthread\r\nidentifier.\sAnd\smoreover\sdoes\sit\snot\srequire\saccesses\r\nto\sbe\sof\ssomehow\satomic\sor\sotherwise\snuclear\skind.\r\n\r\nMy\sonly\spoint\sis,\sthat\swe\scould\shave\slived\swell\swith\r\nthe\sinitial\simplementation,\sif\swe\swould\shave\sadded\r\ninitial\slocks,\swhen\swe\sinitialize\sour\smutex\sstructure.\r\nAnd\sof\scourse\sditched\sthe\snative\srecursive\sPOSIX\sstuff\r\nin\sfavor\sof\sour\sown\sbreed\sdue\sto\sthe\smisfit\swith\r\nPOSIX\scondition\svariables.\r\n\r\nSo\sthe\spmutexPtr->thread\svalue\sis\seither\sour\spthread_self()\r\nor\snot.\sAnd\sthis\scondition\sis\s*always*\sensured\swhen\swe\r\nmodify\sit\sonly\swhen\swe\shold\sthe\scritical\ssection.\sEven\r\nwhen\swe\sgive\sup\sownership\sby\swriting\sPTHREAD_NULL.\r\n\r\nMost\sof\sthis\sargumentation\scan\sbe\stranslated\sto\sWin32\r\nas\swell.
J login chw
J mimetype text/plain
K 893f8cc5db3ba8bd6bed80ce89a0a75c6088a37c
U chw
Z a307635f51dd616f2b353f37c6128d17