Skip to content
Tcl Source Code Artifact [a1e8dc4f04]
Login

Artifact [a1e8dc4f04]

Artifact a1e8dc4f04ebc8aa9998a94572cfff734d3d8fba4b96c58d4102d161fa2a64ca:

Ticket change [a1e8dc4f04] - Ticket [3096275fffffffff|3096275fff] <i>Sync fcopy buffers input</i> status still Closed with 7 other changes by pooryorick on 2023-04-03 18:16:19.
D 2023-04-03T18:16:19.314
J closedate 2460038.26133465
J closer pooryorick
J comment The\sfollowing\sscript:\r\n\r\n\sfconfigure\sstdin\s-translation\sbinary\s-blocking\s0\r\n\sfconfigure\sstdout\s-buffering\snone\s-translation\sbinary\r\n\sfcopy\sstdin\sstdout\r\n\r\nwhen\sfed\sby\styping\slines\sto\sstdin,\swill\snot\soutput\sanything\suntil\seither\s4k\shave\sbeen\styped\sor\seof,\sdespite\sthe\snonblocking\smode\son\sstdin.\r\nThe\ssame\susing\san\sasync\sfcopy,\swill\swork\sin\sa\smore\sresponsive\smanner:\r\n\r\n\sfcopy\sstdin\sstdout\s-command\sdone\r\n\svwait\sforever\r\n\r\nThis\sis\sa\sconsequence\sof\sthe\sfollowing\scredo,\sin\sa\scomment\sin\sTclCopyChannel:\r\n\r\n\s\s\s\s/*\r\n\s\s\s\s\s*\sSet\sup\sthe\sblocking\smode\sappropriately.\sBackground\scopies\sneed\r\n\s\s\s\s\s*\snon-blocking\schannels.\sForeground\scopies\sneed\sblocking\schannels.\sIf\r\n\s\s\s\s\s*\sthere\sis\san\serror,\srestore\sthe\sold\sblocking\smode.\r\n\s\s\s\s\s*/\r\n\r\nAs\sa\sconsequence,\swhile\sGetInput\shappily\sreturns\sshort\sreads,\sDoRead\sinsists\son\sfilling\sup\sits\s4k\sbuffer.\r\n\r\nThat\sis,\ssync\sfcopy\swill\snever\spass\sshort\sreads\son\sto\sthe\soutput\schannel.\sHence,\ssync\sfcopy\sis\snot\sadapted\sto\slive\sstreams,\swhile\sasync\sfcopy\sis.\r\n\r\nThis\sit\sat\sleast\ssurprising\sfor\sthe\sdeveloper,\ssince\sthe\ssync/async\sfcopy\sdecision\sis\srather\sbased\son\sexternal\sconsiderations\slike\s"do\sI\sneed\sto\sinterleave\sit\swith\sother\sIO"\sor\s"do\sI\sneed\sto\skeep\sa\sGUI\sresponsive".\sThe\sfact\sthat\schosing\ssync\simplies\sbuffering\sby\s4k\sis\snowhere\sin\sthe\sdocs.\r\n\r\nLow\sprio\sbecause\sit's\sa\sDay-1\sissue\s:/
J icomment This\sreport\sdealt\swith\sReadBytes().\s\sSee\salso\s[9ca87e6286]\sfor\sthe\ssame\sissue\swith\sReadChars().
J login pooryorick
J mimetype text/x-fossil-wiki
J severity Minor
K 3096275fffffffffffffffffffffffffffffffff
U pooryorick
Z 704a636ccb8530d08de5c14f7b66cded