Skip to content
Tcl Source Code Artifact [4315e25c30]
Login

Artifact [4315e25c30]

Artifact 4315e25c301a72fecd6f628e9a3288e9b3bf4789820f20bdf9c7cc24039feded:

Ticket change [4315e25c30] - Ticket [893f8cc5db3ba8bd|893f8cc5db] <i>Nested mutexes following TIP 509</i> status still Open with 3 other changes by sebres on 2025-09-18 15:55:51.
D 2025-09-18T15:55:51.972
J icomment >\sthere\sis\sno\sguaranteed\sthat\sthose\smemory\slocations\sare\swritten\sback\sinto\smain\smemory\sor\ssynchronized\swith\sother\scaches.\r\n\r\nThere\sis\s(as\sfor\ssingle\svolatile\svariable).<br/>\r\n\r\nThe\scache\sof\smodern\sCPUs\sis\salways\scoherent\s(if\swe\sdon't\sspeak\sabout\sGPUs\sor\ssome\sspecial\sprocessors)\s-\sthat\sis\ssimply\sa\sbasic\srequirement.<br/>\r\nVolatile\swould\s"guarantee"\sthe\s"atomicity"\sand\sdurability\s(of\ssingle\svariable)\sand\sprevents\sagainst\sreordering\sor\saggressive\soptimization\sissues.\sOne\scannot\suse\svolatile\sto\ssynchronize\saccess\sto\snon-volatile\sdata,\sbut\sit\sdoesn't\shappen\shere.<br/>\r\nSo\swithout\smemory\sbarriers\swe\scan\sonly\sdoubt\sthe\satomicity\sof\stwo\svariables\s(thread\sand\scounter)\stogether,\sbut\sbecause\sthey\swould\sbe\schanged\sonly\sin\sthe\slock\sand\sbecause\scounter\sis\sinteresting\sonly\sif\sthe\sthread\sowned\sthe\slock,\sit\sis\sOK\sfor\sthe\ssecond\sthread,\sbecause\sif\sit\senters\sthe\slock,\sthe\scounter\smust\sbe\sagain\s0\s(after\sunlock\sof\sother\sthread).\sI\sdon't\ssee\sthe\sRC\shere\sright\snow\s(for\sthe\scode\spieces\syou\sprovided\sbefore),\sbut\sone\shave\sto\slock\scloser\son\sthe\swhole\ssolution\s(no\stime\scurrently).\r\n\r\nHowever\sI\sam\sanyway\sfor\sreal\satomic\sfacilities,\swhich\swould\sprovide\smuch\smore\sbetter\svariants\sto\shandle\sthat,\swithout\sto\sthink\sabout\smemory\sbarriers\sand\smay\sprevent\smany\sRC\sscenarios.
J login sebres
J mimetype text/x-fossil-wiki
K 893f8cc5db3ba8bd6bed80ce89a0a75c6088a37c
U sebres
Z d5ea1e797026014a0874065e5e73a385