Fix polling of files on Windows

This commit is contained in:
Justine Tunney 2024-09-11 17:13:23 -07:00
parent 0f3457c172
commit 6f868fe1de
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
2 changed files with 36 additions and 1 deletions

View file

@ -179,7 +179,7 @@ textwindows static int sys_poll_nt_impl(struct pollfd *fds, uint64_t nfds,
// check input status of pipes / consoles without blocking
// this ensures any socket fds won't starve them of events
// if a file handle is POLLOUT only, we just mark it ready
// we can't poll file handles, so we just mark those ready
for (i = 0; i < pn; ++i) {
fi = fileindices[i];
ev = fds[fi].events;
@ -215,6 +215,8 @@ textwindows static int sys_poll_nt_impl(struct pollfd *fds, uint64_t nfds,
fds[fi].revents = fds[fi].events & (POLLRDNORM_ | POLLWRNORM_);
break;
}
} else {
fds[fi].revents = fds[fi].events & (POLLRDNORM_ | POLLWRNORM_);
}
rc += !!fds[fi].revents;
}