Skip to content
Tcl Source Code Artifact [a1bd4639a4]
Login

Artifact [a1bd4639a4]

Artifact a1bd4639a4f469d44a870664bcf0ce8913fd9202578bc4c16d0467be8a06ce5b:

Ticket change [a1bd4639a4] - Ticket [893f8cc5db3ba8bd|893f8cc5db] <i>Nested mutexes following TIP 509</i> status still Open with 3 other changes by chw on 2025-08-24 19:29:04.
D 2025-08-24T19:29:04.282
J icomment Harald,\sI\scannot\sattend\stomorrow,\sso\slet\sme\stry\sto\sdescribe\sthe\r\ncurrent\ssituation\swith\sthis\sexample:\r\n\r\n\s\sTcl_MutexLock(&mutex);\s\s\s/*\sA\s*/\r\n\s\sTcl_MutexLock(&mutex);\s\s\s/*\sB\s*/\r\n\s\swhile\s(something)\s{\r\n\s\s\s\s\s\sTcl_ConditionWait(&cond,\s&mutex);\s\s\s/*\sC\s*/\r\n\s\s}\r\n\s\sTcl_MutexUnlock(&mutex);\s/*\sD\s*/\r\n\s\sTcl_MutexUnlock(&mutex);\s/*\sE\s*/\r\n\r\n1)\sFor\sPOSIX\swith\snative\srecursive\soption:\r\n\r\n*\sstep\sC\sdecrements\sthe\slock\sonly\sby\sone\r\n*\sthis\smeans\sthe\scritical\ssection\sremains\slocked\r\n*\sand\smost\slikely\sthe\swake\sup\scan\snever\shappen\sdue\sto\sthe\slock\r\n*\sdeadlock\sis\sthe\soutcome\r\n\r\n2)\sFor\sPOSIX\swith\semulated\srecursion\scounter:\r\n\r\n*\sstep\sC\sreleases\sthe\smutex\swithout\saccounting\sfor\sthe\slock\scount\r\n*\sthe\scritical\ssection\sis\sunlocked\r\n*\sthe\swake\sup\scan\shappen\r\n*\safter\swake\sup\sthe\scritical\ssection\sis\slocked\sagain\r\n*\sbut\sthe\sbookkeeping\sof\sthe\sownership\sand\sthe\slock\scount\sget\slost\r\n*\sbad\sthings\shappen\slater\r\n\r\n3)\sFor\sWin32\ssee\s1)\r\n\r\nBoth\spatches\sfor\sPOSIX\semulated\s2)\sand\sWin32\s3)\stry\sto\sfix\sthe\r\nbookkeeping\sat\sthe\send\sof\sTcl_ConditionWait()\sand\swould\sallow\sfor\r\na\snatural\sexpected\sbehavior.\r\n\r\nBut\sPOSIX\snative\sin\s1)\scannot\sbe\sfixed\sat\sall.
J login chw
J mimetype text/plain
K 893f8cc5db3ba8bd6bed80ce89a0a75c6088a37c
U chw
Z afeb22ffe5cd164d1bc04709d6f5a1d1