<i>Unix: Start notifier thread in Tcl_InitNotifier again if process id changed due to fork1</i>.
by
.
D 2013-07-17T15:23:55.010
J assignee nobody
J closer nobody
J cmimetype text/x-fossil-wiki
J comment Rivet,\sthe\sApache\stcl\smodule,\sdoes\sthe\sfollowing:\r\n\r\n\s\s#\s\sApache\sstarts\sone\sprocess\sand\sstarts\sa\sTCL\sinterpreter\r\n\s\s#\s\sUsers\shave\sthe\sability\sto\sexecute\scommands\snow.\sFor\sthe\shuge\sFlightAware\swebsite,\sit\swas\swritten,\sthat\sloading\spackages\snow,\sinstead\sin\sstep\s4,\ssaves\s40\sminuites\sof\stime.\r\n\s\s#\s\sApache\sforks\sthis\sprocess\sto\sworker\sprocesses\sincluding\sthe\sinitialized\sTCL\sinterpreter.\sThe\sNotifier\sThread\srequired\sfor\s<b>fileevent</b>\sis\snot\spresent\sin\sthe\snew\sprocess.\r\n\s\s#\s\sUsers\shave\sthe\spossibility\sto\sdo\sper\sprocess\sinitialisation\shere,\slike\sdata\sbase\sopen\setc.\r\n\s\s#\s\sIf\sa\spage\sis\srequested,\san\sinterpreter\sin\sa\sworker\sprocess\sis\scalled.\r\n\r\nThe\sissue\sis,\sthat\s<b>fileevents</b>\sdo\snot\sfire\sany\smore,\sas\sthere\sis\sonly\sone\snotifier\sthread\sin\sthe\sfirst\sprocess.\r\nThe\snotifier\sthread\sis\sinvoked\sby\sall\sprocesses\sas\sthe\sanonymous\spipe\sis\sstill\sactive\sbut\shas\sno\saccess\sto\sshared\smemory\sand\sfile\shandlers\sof\sthe\sforked\sprocesses.\r\n\r\nThe\sidea\sis\sto\smodify\sthe\sexposed\sprocedure\s<b>Tcl_InitNotifier</b>\sto:\r\n\s\s#\s\sCheck,\sif\sit\swas\sforked,\se.g.\sif\sthe\sprocess\sid\schanged\r\n\s\s#\s\sIf\sso,\sclose\sthe\sconnection\sto\sthe\spipe\sand\sstart\sa\snew\snotifier\sthread.\r\n\r\nThen,\s<b>Tcl_InitNotifier</b>\smay\sbe\scalled\safter\sthe\sfork\sand\sanything\sis\sworking\sagain...\r\n\r\nThe\scurrent\sversion\sof\s<b>Tcl_InitNotifier</b>\sonly\screates\sthe\sthread\son\sthe\svery\sfirst\scall\sand\sthus\sdoes\snot\srecreate\safter\sthe\sfork.\r\n\r\nSome\sweb\spointers:\r\n\s\s*\s\s[https://groups.google.com/forum/#!topic/comp.lang.tcl/Ja01kv75tVk|clt\sthread\s"Async\ssockets\shang\sunder\sRivet\sbut\swork\sin\stclsh\s8.6"]\r\n\s\s*\s\s[https://issues.apache.org/bugzilla/show_bug.cgi?id=55153|Rivet\sBug\s55153\s"fileevents\sdo\snot\sfire"]
J foundin 8.6.0
J is_private 0
J login oehhar
J priority 5\sMedium
J private_contact 0f366eb3e9e2fcab52b8ebacd197db9047186a5f
J resolution None
J severity Important
J status Open
J submitter oehhar
J subsystem 01.\sNotifier
J title Unix:\sStart\snotifier\sthread\sin\sTcl_InitNotifier\sagain\sif\sprocess\sid\schanged\sdue\sto\sfork1
J type RFE
K a0bc856dcde485c71fc657fc9387842e41b6449d
U oehhar
Z ebfca111524995a823fa5d13959563e7