Skip to content
Tcl Source Code Artifact [1d26088482]
Login

Artifact [1d26088482]

Artifact 1d2608848223d41de4bb29ed850b731fdc1435a2:

Ticket change [1d26088482] - Ticket [3608957fffffffff|3608957fff] <i>Events posted by Tcl_QueueEvent linger in queue</i> status still Open with 4 other changes by jenglish on 2013-03-25 08:00:07.
D 2013-03-25T08:00:07
J icomment The\sidea\sbehind\swrite-to-pipe\sis:\suse\spipe(2)\sto\sget\sa\spair\sof\sconnected\sfile\sdescriptors;\sin\sthe\sevent\sloop\slisten\son\sthe\sread\send\s(with\sselect,\spoll,\skqueue,\swhatever),\sand\sin\sthe\ssignal\shandler\swrite\sa\ssingle\sbyte\s(generally\sthe\ssignal\snumber)\sto\sthe\swrite\send.\s\sThat\swill\swake\sup\sthe\sevent\sloop,\swhich\scan\sread\sthe\spipe\sto\sdetermine\swhich\ssignal\swas\ssent.\n\nwrite(2)\sis\sasync-signal\ssafe,\swhereas\salmost\snone\sof\sthe\spthread_*\sroutines\sare.\s\sThat's\swhy\sthis\sapproach\sis\spreferred.\n\n>\sI\sswitched\sto\sTcl_AsyncMark\sfor\smy\slibrary,\sbecause\sapparently\n>\s\sthat\scommand\swas\sspecifically\sdesigned\sto\shandle\scases\slike\sthis\s\n\nThat\smay\shave\sbeen\sthe\soriginal\sintent,\sbut\ssince\sthe\sfirst\sthing\sTcl_AsyncMark()\sdoes\sis\slock\sa\smutex,\sit\scan't\sbe\scalled\sfrom\sa\ssignal\shandler\seither.\n\n>\sand\sit\sseems\sto\swork\sjust\sfine.\n\n"seems"\sbeing\sthe\soperative\sword\shere\s:-)\s\sIf\sa\ssignal\sever\sgets\sdelivered\swhile\sTcl\sis\sin\sthe\smiddle\sof\san\sAsyncInvoke\sor\sother\scritical\ssection,\sthe\sprocess\swill\sdeadlock.\s\s\n\nAlso\sbeware:\sasync\shandlers\sare\scalled\sat\svery\sprecarious\stimes;\sthe\sinterp\scan\sbe\sin\salmost\sany\sstate,\syou\shave\sto\sbe\svery\scareful.\s\s(Scheduling\sa\scallback\swith\sTcl_QueueEvent\sis\sabout\sthe\sonly\sthing\syou\sshould\sdo\sin\san\sasync\shandler).\n
J login jenglish
J mimetype text/plain
J username jenglish
K 3608957fffffffffffffffffffffffffffffffff
U jenglish
Z 3761f1b38f5e42b6bc66416ea5af5bf3