Skip to content
Tcl Source Code Artifact [09bc761349]
Login

Artifact [09bc761349]

Artifact 09bc76134932d4363ff9c25f4ddb541af1140b0e:

Ticket change [09bc761349] - Pending ticket [3536564fffffffff|3536564fff]: <i>tcl hangs on parallel execution of commands using open</i> plus 8 other changes by andreas_kupries on 2012-07-18 00:33:04.
D 2012-07-18T00:33:04
J closedate 2012-07-17T17:33:04
J closer andreas_kupries
J icomment Hello\sDeepanshu.\n\nThank\syou\sfor\sproviding\stest\sscripts.\sReviewing\sthem\sI\sfind\sfairly\sbig\sproblems\sin\s2.tcl,\sand\sthe\sattempted\suse\sof\sfileevents.\sFirst,\sthe\slines\n\n\s\s\s\sfileevent\s$imChannel1\sreadable\s[set\sout1\s[isProcessDone\s$imChannel1\s$out1]]\s\n\n(and\sequivalent\sfor\schannel\s2)\shave\sthe\sproblem\sthat\s'isProcessDone'\sis\sexecuted\simmediately,\sand\snot\sin\sresponse\sto\sfileevents.\sBecause\syou\sare\susing\s[...]-quoting\swhich\sevaluates\sthe\scommand\sdirectly.\sThis\salso\smeans\sthat\swhile\syou\sare\sopening\s2\spipes,\syou\sare\sthen\slooking\sat\sthem\ssequentially,\snot\sin\sparallel.\n\nFurther,\syou\sare\snot\sreconfiguring\syour\schannel\sto\sbe\snon-blocking,\swhich\sis\sstrongly\srecommended\swhen\sworking\swith\sfileevents.\sOtherwise\syour\sread/gets\sin\sa\sfileevent\shandler\sprocedure\scan\sblock.\sMaking\sthings\slook\slike\sa\shang.\n\nThen\s'isProcessDone'\sitself\saccesses\sthe\schannel\sin\sa\sloop\swaiting\sfor\sEOF.\sWith\sfileevents\ssuch\sa\sloop\swould\snot\sbe\snecessary,\sas\syour\shandler\swould\sget\scalled\swhen\sEOF\sis\sreached,\sallowing\syou\sto\stest\sand\sclose,\swithout\san\sexplicit\sloop.\n\nLastly,\sas\syou\sare\susing\stclsh\sno\sstandard\sevent\sloop\sis\sstarted\s(like\swish\swould\sdo),\sand\syou\sare\snot\sstarting\san\sevent\sloop\seither\s(I\ssee\sno\s'vwait'\scommand).\n\nWith\sall\sthese\sproblems\sin\sthe\scode\sI\scurrently\sbelieve\sthat\sthe\ssource\sof\syour\sproblem\s(hang)\sis\sto\sbe\sfound\sin\sthere,\sand\snot\sin\sthe\sTcl\score\sitself.\n\nExamples\sof\sproper\sfileevent\susage\scan\sbe\sfound\sat\n\s\s\s\shttp://www.activestate.com/blog/2010/05/concurrency-tcl-events-without-getting-twisted\n\s\s\s\shttp://wiki.tcl.tk/1757\n\s\s\s\shttp://www.tcl.tk/man/tcl8.5/tutorial/Tcl40.html\n
J login andreas_kupries
J mimetype text/plain
J priority 4
J resolution Invalid
J status Pending
J username andreas_kupries
K 3536564fffffffffffffffffffffffffffffffff
U andreas_kupries
Z 219ddd5b922f988057e64cb3bf314763