Open mtstickney opened 4 years ago
Note to self: assuming the patch for #1 gets merged, the socket part of this is easy (just pass the timeout through to select
). Pipes might not be possible: Windows apparently has ways to read from a pipe asynchronously (the usual overlapped I/O or completion-port stuff), but not to wait until there is data available (pipes cannot be used with the WaitFor*
functions, as they are not a supported object type).
Consoles can be waited on with the WaitFor*
functions, but you're going to want to be sure those will correctly end on EOF as well as actual input. Also means messing with win32_tty_listen
, which is doing some... interesting things with condition variables and whatnot. E.g. you can't just replace PeekConsoleInput with a wait either, because a lock is held there.
Oh, nice! Thanks for the heads up; I'm going to have to get back to this stuff one of these days.
The issue here is that waiting is done by polling with
handle-listen
, but the timeout value isn't passed like it is withsb-unix:simple-unix-poll
. It's possible not all handle types will support polling timeouts, but sockets certainly would. We should do that, because busy-looping is for suckers (cl+ssl useswait-for-fd-usable
and is probably subject to this problem).