<i>WinSock cores/hangs on thread or app exit</i> status still Open with 4 other changes
by
.
D 2006-03-01T04:19:39
J icomment Logged\sIn:\sYES\s\nuser_id=95086\n\nOK.\sEasy.\s\sBut\syou\swill\shave\sto\sfollow\sme...\n\nIf\syou\sopen\sa\ssocket,\sdon't\sclose\sit\sand\sexit\sthe\sthread\n(or\sthe\sapplication,\s\sthis\swill\seventually\scome\sto\n\n\s\sTcl_FinalizeThread()\n\nThe\sTcl_FinalizeThread\swill\spull\sthread-exit\shandlers\none\sby\sone.\sOne\sof\sthem\swill\sbe\sthe\shandler\sto\stear\sdown\nthe\ssocket\ssubsystem.\nThis\sthread-exit\shandler\swill\stear-down\sthe\ssocket\sthread\sand\nall\sthe\ssync\sprimitieves\sfor\sthe\ssynchronization.\sAfter\sthat\s\nno\scalls\sinto\sthis\ssubsystem\sshould\sbe\sperformed.\nBut....\nAfter\sthat,\sthe\sTclFinalizeIOSubsystem()\sis\scalled.\nThe\sTclFinalizeIOSubsystem\swalks\sthe\slist\sof\sopened\schannels,\nfounds\sone\sstill\sopened\sand\stries\sto\sclose\sit\s(line\s254\sin\sgeneric/tclIO.c).\nThe\sTcl_Close\swill\sinvoke\sCloseChannel\sand\sthis\swill\scall\sTcl_CutChannel.\nThe\sTcl_CutChannel\swill,\sas\sthe\slast\sstep\sof\soperation,\scall\nThreadActionProc\swith\s\sTCL_CHANNEL_THREAD_REMOVE.\nUnderstand?\sNow,\sthe\sThreadActionProc\swill\sresult\sin\s\nTcpThreadActionprroc\s(line\s2689\swin/tclWinChan.c)\sand\swill\sstart\s\nusing\stsdPtr->socketListLock,\swill\sattemt\sto\sSendMessage\sto\s\nwindow\sowned\sby\sthe\sSocketThread\swhich\salready\sis\sexited\s\nand\sso\son\sand\sso\son...\s\n\nIs\sthis\snow\slittle\sbit\smore\sclear?\n\nConcerning\slazy\sinit/teardown\sof\ssocket\ssubsystem,\sthe\sanswer\sis:\syes.\nIf\sthis\sis\sin\splace,\sthen\sthis\swill\sbe\sbetter\sand\smore\slogical.\sThe\sfirst\nchannel/socket\sinits,\sthe\slast\sclosing\stears\sdown\sthe\ssubsystem.\nThis\sis\show\sI'd\sdo\sthe\sthing\sIf\sI\shad\sdesigned\sit.\sBut\sI\swas\snot\sso\sI\nhad\sto\sat\sleast\srectify\sthe\sobviously\sbroken\scurrent\simplementation.\n\n\n
J login vasiljevic
J mimetype text/plain
J username vasiljevic
K 1437595fffffffffffffffffffffffffffffffff
U vasiljevic
Z 1165473e8022803a8e6abbfd82712bfe