Skip to content
Tcl Source Code Artifact [62c65d4132]
Login

Artifact [62c65d4132]

Artifact 62c65d4132c56c3e992ee0e728ebbd9c5d8092af:

Ticket change [62c65d4132] - Ticket [992108ffffffffff|992108ffff] <i>TclpFinalizeLock on Unix not correct.</i> status still Open with 4 other changes by vasiljevic on 2004-07-17 17:37:34.
D 2004-07-17T17:37:34
J icomment Logged\sIn:\sYES\s\nuser_id=95086\n\nOK.\s\nThe\sremaining\sthing\sto\sbe\sresolved\shere\sis:\s\n\s\n\spthread_mutex_unlock(&initLock);\s\n\spthread_mutex_destroy(&initLock);\s\n\s\nTheoretically,\syou\shave\sa\sclasscal\srace\scondition\shere.\s\nIf\stwo\sthreads\sattempt\sto\scall\sTcl_Finalize,\sat\sthe\s\nmoment\syou\srelease\sthe\s\sinitLock\smutex\sin\sthe\s\s\nfirst\sthread,\sthe\sother\sthread\sstarts\sthe\scalling\s\s\nTclFinalizeLock()\sand\syou\sgo\sthru\sthe\scall\stwice,\s\ndestroying\sthe\salready\sdestroyed\sallocLock,\s\s\nmasterLock\sand\sinitLock\smutexes.\s\n\s\nThis\sis\svery\stricky\sto\ssolve\scorrectly.\sYou\s\smay\sdo\s\npthread_mutex_destroy(&allocLock),\sallocLock\s=\sNULL;\s\npthread_mutex_destroy(&masterLock),\smasterLock\s=\sNULL;\s\n\s\nto\savoid\sthese\stwo\straps\s(in\swhich\scase\scurrent\sfreebsd\s\nimplementation\swill\sreturn\s\sEINVAL)\s\sbut\syou're\sleft\swith\s\nthe\spotential\shazardous\sinitLock\swhere\syou\scan\sgo\sand\s\nhit\sthe\sdestroyed\sbut\snot\sre-initialized\smutex\sand\sdefinitely\s\nget\sthe\ssegmentation\sat\sthe\sline:\s\n\s\s\n\s\s\s_SPINLOCK(&(*mutex)->lock);\s\n\s\nin\spthread_destroy_mutex()\s\n\s\nIn\sorder\sto\savoid\sthis,\syou\smust\sget\syet\sanother\smutex\s\s\nand\sthe\sstory\srepeats.\sEventually,\syou\smust\sat\sleast\s\naccept\sone\sleaked\smutex\s(the\sinitLock).\s\nI\ssee\sno\sother\spossibility.\sDo\syou?\s\n\s\n
J login vasiljevic
J mimetype text/plain
J username vasiljevic
K 992108ffffffffffffffffffffffffffffffffff
U vasiljevic
Z a420b4cc1e56c22b66d5561dea773a42