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

@ -29,7 +29,7 @@
* On Windows it's only possible to poll 64 file descriptors at a time.
* This is a limitation imposed by WSAPoll(). Cosmopolitan Libc's poll()
* polyfill can go higher in some cases. For example, you can actually
* poll 64 sockets and 64 pipes/terminals at the same time. Furthermore,
* poll 64 sockets and 63 non-sockets at the same time. Furthermore,
* elements whose fd field is set to a negative number are ignored and
* will not count against this limit.
*
@ -59,8 +59,10 @@
* @return fds[𝑖].revents is always zero initializaed and then will
* be populated with POLL{IN,OUT,PRI,HUP,ERR,NVAL} if something
* was determined about the file descriptor
* @raise E2BIG if we exceeded the 64 socket limit on Windows
* @raise EINVAL if we exceeded the 64 socket limit on Windows
* @raise ECANCELED if thread was cancelled in masked mode
* @raise EINVAL if `nfds` exceeded `RLIMIT_NOFILE`
* @raise ENOMEM on failure to allocate memory
* @raise EINTR if signal was delivered
* @cancelationpoint
* @asyncsignalsafe