Rewrite Windows poll()

We can now await signals, files, pipes, and console simultaneously. This
change also gives a deeper review and testing to changes made yesterday.
This commit is contained in:
Justine Tunney 2024-09-10 18:59:06 -07:00
parent cceddd21b2
commit fbdf9d028c
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
15 changed files with 425 additions and 191 deletions

View file

@ -1166,9 +1166,9 @@ static void PerformBestEffortIo(void) {
DEBUGF("poll() toto=%d [grace=%,ldns]", toto,
timespec_tonanos(GetGraceTime()));
if (toto) {
if (fds[0].revents & (POLLIN | POLLERR))
if (fds[0].revents & (POLLIN | POLLHUP | POLLERR))
ReadKeyboard();
if (fds[1].revents & (POLLOUT | POLLERR))
if (fds[1].revents & (POLLOUT | POLLHUP | POLLERR))
WriteVideo();
}
} else if (errno == EINTR) {
@ -1299,7 +1299,7 @@ static void PickDefaults(void) {
*
* strcmp(nulltoempty(getenv("TERM")), "xterm-direct") == 0
*/
if (strcmp(nulltoempty(getenv("TERM")), "xterm-kitty") == 0)
if (IsWindows() || !strcmp(nulltoempty(getenv("TERM")), "xterm-kitty"))
ttyquantsetup(kTtyQuantTrue, TTYQUANT()->chans, kTtyBlocksUnicode);
}