Fix POLLIN|POLLOUT when together on Windows

This commit is contained in:
Justine Tunney 2023-08-08 07:16:46 -07:00
parent 33d280c8ba
commit c48ee8e4fe
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
3 changed files with 32 additions and 4 deletions

View file

@ -131,7 +131,7 @@ textwindows int sys_poll_nt(struct pollfd *fds, uint64_t nfds, uint64_t *ms,
if (pipefds[i].events & POLLOUT) {
// we have no way of polling if a non-socket is writeable yet
// therefore we assume that if it can happen, it shall happen
pipefds[i].revents = POLLOUT;
pipefds[i].revents |= POLLOUT;
}
if (pipefds[i].events & POLLIN) {
if (GetFileType(pipefds[i].handle) == kNtFileTypePipe) {
@ -140,15 +140,15 @@ textwindows int sys_poll_nt(struct pollfd *fds, uint64_t nfds, uint64_t *ms,
pipefds[i].handle, avail, ok);
if (ok) {
if (avail) {
pipefds[i].revents = POLLIN;
pipefds[i].revents |= POLLIN;
}
} else {
pipefds[i].revents = POLLERR;
pipefds[i].revents |= POLLERR;
}
} else {
// we have no way of polling if a non-socket is readable yet
// therefore we assume that if it can happen it shall happen
pipefds[i].revents = POLLIN;
pipefds[i].revents |= POLLIN;
}
}
if (pipefds[i].revents) {