Skip to content
Tcl Source Code Artifact [acb923e5fe]
Login

Artifact [acb923e5fe]

Artifact acb923e5fe6b618ba2d532766a87c9aef9978364:

Ticket change [acb923e5fe] - Ticket [2869384fffffffff|2869384fff] <i>Tcl_AsyncMark does not work with --enable-threads</i> status still Open with 4 other changes by flatworm on 2009-09-29 15:17:48.
D 2009-09-29T15:17:48
J icomment I've\shit\sthis\swhile\simplementing\san\sextension\sto\shandle\sPOSIX\ssignals\s(it's\sunfinished\syet\sso\snot\sreleased).\n\nThe\sproblem\sappears\sto\sbe\smore\scomplex\sand\sI\sdoubt\sit\scan\sbe\sfixed\sat\sall\sfor\sall\spossible\scases\sof\sa\sdeadlock,\nsimply\sbecause\spthread's\smutex\sis\sallowed\sto\sdeadlock\swhen\slocked\stwice\sfrom\sthe\ssame\sthread,\sand\sthat's\nwhat\sit\sdoes\son\sLinux\s2.6\sat\sleast.\n\nThe\sproblem\sis\sthat\sthe\ssignal\shandler\sbumps\sinto\sthe\sthread's\sexecution\sstack\sat\sunpredictable\smoments,\nand\shence\sthe\ssignal\shandling\scan\sbe\sconsidered\sas\sa\s"superthread"\swhich\sdon't\splay\sby\sthe\susual\srules\sfor\sthreads.\n\nConceptually,\sto\smake\sTcl_AsyncMark()\s(and\sany\sother\sfunction\swhich\stries\sto\slock\sthe\starget\sthread's\sLTS)\snot\sdeadlock,\nwe\shave\sto\smake\slocking\sfunction\sonly\sattempt\slocking\sif\ssome\sflag\sis\snot\sraised\s(meaning\sthat\sno\slock\nis\sheld).\sBut\susing\sa\sflag\smeans\ssharing\sa\smutable\sstate,\swhich\sinherently\simplies\susing\sanother\smutex,\sso\swe're\sback\sat\sthe\sstarting\spoint.\nMasking\sall\ssignals\sbefore\slocking\sthe\sLTS\smutex\sis\salso\sa\sbad\sidea:\sa)\stoo\smany\ssyscalls\sb)\sthis\sdoesn't\shelp\sto\sprevent\smutual\sdeadlocks\sbetween\stwo\sthreads.\n\nSo,\sin\smy\spackage\smentioned\sabove\sI\sfinally\simplemented\sa\ssolution\sinvolving\sa\sspecial\smanager\sthread\swith\swhich\ssignal\shandlers\sinteract\sand\swhich\sdispatches\sevents\sto\starget\sthreads.\sThe\ssolution\sis\scomplicated\sbut\sworks.\sAs\sI\sintend\sto\srelease\sthe\scode\sunder\sa\sTcl-like\slisence,\sI\swill\sbe\shappy\sto\sshare\sit,\sif\syou\sso\swish.\n
J login flatworm
J mimetype text/plain
J username flatworm
K 2869384fffffffffffffffffffffffffffffffff
U flatworm
Z c20fec637269d5fc98ddb05ca54e0f7d