<i>Thread pool panics if stdin closed and IO performed in initcmd</i> status still Closed with 5 other changes
by
.
D 2025-02-24T23:20:20.804
J closedate 2460731.47246301
J closer sebres
J icomment Well,\sit\slooks\slike\sthis\sis\sindeed\san\sissue\sof\stcl\s(not\sthe\sthread-module).\r\n\r\nHere\sis\sthe\sexperimental\scommit\sthat\ssolves\sthe\sissue\s-\s[93d9a20635].\sAlthough\sI'm\snot\squite\sconvinced\swith\sthis\ssolution.\r\n\r\nIn\sgeneral\sthe\susage\sof\sstandard\schannels\sacross\sthreads\sis\snot\swell\sthought\sout\sin\stcl-IO:\r\n<ul>\r\n<li>the\sstandard\schannels\s(by\stheir\snames)\sare\s"shared"\sacross\sthe\sthreads,\showever\snot\sthe\sinstances\sof\sthem\s(which\sare\squasi\sduplicates\seach\sthread);</li>\r\n<li>so\severy\sthread\sinitializes\sits\sown\sinstance,\sso\sthat\sif\sa\sthread\suses\ssome\sof\sstandard\schannel\sfirst\stime,\sit\sgets\sits\sown\sinstance\s(for\sthe\ssame\sthing)</li>\r\n<li>the\sclose\sof\sstandard\schannel\sin\sone\sthread\swill\sdo\sthat\snot\sfor\sthe\sother\sthread,\sif\sboth\salready\stouched\sit,\sbut\snew\sthread\smay\smiss\sit</li>\r\n<li>the\swhole\sthing\sis\sadditionally\splatform-specific\s(and\smay\sdeviate\se.\sg.\sby\swindows\sif\sit\sis\scloses\sin\smain\sthread,\sthe\snew\sthread\scannot\sobtain\sa\snew\sstandard\shandle\sin\snew\sthread,\son\slinux\sit'd\sbe\sable\sto\sdo\sthat.</li>\r\n<li>to\shandle\sit\sproperly,\sone\shas\sto\sknow\show\smany\sthreads\susing\ssome\sstandard\schannel\s(e.\sg.\sN\sthreads\sin\suse,\sbut\sM\sthread\sever\stouched\ssome\schannel),\sinclusive\spossible\stiming\sissues\son\ssome\srace\scondition.</li>\r\n</ul>\r\n\r\nBasically\sthe\sproper\sand\sconsistent\ssolution\scan\sbe:\r\n<ol>\r\n<li>either\sreal\ssharing\sof\sstandard\schannels\sacross\sthe\sthreads\s(and\scommon\sglobal\sarray\sof\sthem),\swhat\swould\sbe\snot\sso\ssimple\ssince\stcl\sdoesn't\sknow\sabout\s"sharing"\sof\schannels\sat\sall;</li>\r\n<li>or\sfully\sindependent\sstandard\schannels\sacross\sthe\sthreads\s(may\sbe\sagain\splatform-specific\sthing\sor\sat\sleast\sbackwards\sincompatible);</li>\r\n<li>and/or\scomplete\savoidance\sof\simplicit\sreassignment\sof\sstandard\schannels\sby\sopen\safter\sclose\s(need\sthen\ssome\scommand\sto\sdo\sthat\sexplicitly\sif\swanted).</li>\r\n</ol>\r\nIn\sany\scase\sit\sneeds\sa\sclear\sdefinition\swhat\sshall\shappen\smulti-threaded\sby\sclosing\sof\sstandard\schannels\s(in\s"shared"\sand\s"unshared"\sstate),\sbecause\sat\sthe\smoment\sit\sis\srather\san\sUB,\sand\s"duplicate\schannel\snames"\serror\sis\srather\san\safter-effect.
J login sebres
J mimetype text/x-fossil-wiki
K b78d94c049af5090a9ef1c4aaa8059aa45b98b59
U sebres
Z 82b7488007a03b105d6ff5404849b37f