Windows: Use overlapped I/O, CreateFile
Overlapped I/O is win32's asynchronous I/O mechanism, which allows
us to start an I/O operation and explicitly wait for it to finish at
a time of our choosing, such that we can simultaneously await other
events instead of blocking unconditionally.
- Support for overlapped I/O is a per-HANDLE flag specified at
file opening time, necessitating a switch to win32's CreateFile
and away from the CRT's _open.
- Wrap win32 file operations in POSIX-compatible functions, so
that UNIX-OPEN, UNIX-READ, UNIX-WRITE, UNIX-CLOSE continue to
work as before. Under the hood, these now call our Lisp or C
functions instead of versions from CRT.
- For now, these functions still return and expect what passes as
file descriptors in CRT.
- INTERRUPT-THREAD is now capable of performing the interruption
in a target thread blocked in socket I/O, indicated using an
errno of "EINTR". Minor changes in FD streams to retry the I/O
operation explicitly in that case.
Does not yet include changes for console I/O, and instead still
falls back to _read and _write in that case. Also not yet included
is interruptible non-overlapped I/O, e.g. for unnamed pipes.
Thanks to Anton Kovalenko.