Skip to content
Tcl Source Code Artifact [31ed9c318c]
Login

Artifact [31ed9c318c]

Artifact 31ed9c318c81536e2651e4b1288c8e7013972f54:

Ticket change [31ed9c318c] - Ticket [3547994fffffffff|3547994fff] <i>io-29.33b fails on Windows by design</i> status still Open with 4 other changes by twylite on 2012-07-25 03:26:51.
D 2012-07-25T03:26:51
J icomment @\sDavid:\smoving\sall\sIO\sto\soverlapped\sis\sa\sproblem\sbecause\sof\sthe\simpedence\smismatch\sbetween\sthe\sWindows\sand\sTcl\seventing\smodels.\s\sTcl\sexpects\sto\slive\sin\sa\slevel\striggered\sworld.\s\sWindows\sis\sprimarily\sedge\striggered.\s\sThat's\swhy\swe\shave\sthese\sworker\sthreads\sthat\sturn\sthe\sedge\strigger\sinto\sa\slevel\sthat\sa\sTcl\sevent\scheck\sproc\scan\shandle.\n\n>\sIf\sI\sremember\scorrectly,\sthe\smain\snotifier\suses\san\salertable\smechanism\sthat\n>\ssupports\scalling\sa\sCompletionRoutine\sfrom\sit\sshould\sthat\sdirection\sbe\n>\schosen.\n>\sSee\sMsgWaitForMultipleObjectsEx()\swith\sMWMO_ALERTABLE\sflag.\n\nMmm.\s\sOff-topic,\sbut\sI'll\sbite:\sYou\scan't\sactually\suse\sOVERLAPPED\sand\scompletion\sroutines,\sbecause\sof\sthe\simpedence\smismatch.\s\sIn\s*nix\syou\scall\sselect()\sto\ssee\sif\ssomething\sis\sreadable\sor\swritable.\s\sIn\sWindows\syou\sperform\san\soverlapped\sReadFile()\sor\sWriteFile()\sand\sget\snotified\sof\sthe\sresult.\s\sIoCompletion\sports\sdon't\sprovide\sa\sway\sto\snotify\syou\sthat\sa\sstream\shas\spending\sdata.\n\nIf\syou\swant\slevel-based\snotification\sin\sWindows\syou\seither\suse\sselect()\s(as\sin\s*nix,\swith\svery\sslow\spipes\sas\sthe\salert\smechanism),\sor\syou\suse\sWSAAsyncSelect\s(similar\sto\sselect()\sbut\syou\swait\son\sevents\swith\sWaitForMultipleObjects),\sor\syou\suse\sWSAEventSelect\swhich\ssends\smessages\sto\sa\swidows\sin\sa\sthread.\s\sThe\sformer\stwo\shave\slimited\sscalability\s-\sin\sparticular\sWaitForMultipleObjects\shas\sa\slimit\sof\s64\sobjects\sand\sMS\srecommends\sbreaking\slarger\swait\slists\sinto\sgroups\sand\sworker\sthreads.\n\nSo\sI\sdid\sa\squick\sport\sof\stclWinSock.c\sto\suse\sthe\snotifier\swindow\sinstead\sof\sthe\scothread\swindow.\s\sWorks\smarvellously,\suntil\syou\swant\sto\ssimulate\sblocking\sIO\sat\sthe\sTcl\slevel.\s\sAt\sthat\spoint\syou\sneed\sto\swait\son\san\sevent,\swithout\sblocking\swindow\smessages\sfrom\sWSAEventSelect\s(which\swill\sset\sthe\sevent),\swith\sblocking\sany\swindow\smessages\sthat\scould\scause\sthe\sblocking\sIO\sto\sbe\snon-modal.\s\sE_CANT_DO.\n\nIt\s_should_\sbe\spossible\sto\srework\sthe\sWindows\snotifier,\ssockets\sand\spipe\scode\sto\suse\sjust\sone\sadditional\sthread\sper\sprocess.\s\sIt's\sa\smajor\schange.\n\nIt's\sall\sgreat\sright\suntil\syou\swant\sto\sdo\sblocking\s(from\sTcl's\sperspective)\ssocket\sIO\sin\sthe\smain\sthread.\s\sThen\syou\scan't\suse\sMsgWaitForMultipleObjectsEx()\s\n\n
J login twylite
J mimetype text/plain
J username twylite
K 3547994fffffffffffffffffffffffffffffffff
U twylite
Z c46a2130990c8d1dbeec58c0667539e3