A wait polling a regular-file event holds the equeue mutex and calls
sceKernelLseek, which takes the descriptor's position lock on Windows.
sceKernelClose and close took that lock first and then the equeue mutex
in EqueueDescriptorClosed, so a close racing such a wait deadlocked. Both
now remove the descriptor's events before taking the position lock, as
dup2 already does.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Both threw for a regular file. They now follow FreeBSD 11.4's
filt_vfsread and filt_vfswrite: a read event reports the file size less
the descriptor's offset and fires while that is not 0; a write event
always fires with data 0. A wait holding such an event polls it again
every millisecond, as no host call reports every file change. A size
above 1 and other vnode types still throw.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
PipeRead (guest_kqueue) and the blocking read in guest_socket_events took
their start time after creating the thread that writes after 50 ms, so a
main thread preempted between the two measured less than the writer's
sleep and failed the 40 ms check although the wait did block until the
write.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The listener read event now reports one connection after the first connect, and on Linux two once a second client is waiting, before both are accepted.
A wait on an equeue that holds socket events now blocks in poll/WSAPoll on
those sockets plus a per-thread loopback wake socket, instead of rechecking
every millisecond. Adding, triggering or deleting an event and closing the
equeue wake the blocked waiters. Closing a socket removes its read and write
events, as on FreeBSD. A read event also reports EV_EOF once the peer has
shut down its sending side.
sceKernelAddReadEvent/DeleteReadEvent and sceKernelAddWriteEvent/
DeleteWriteEvent register EVFILT_READ and EVFILT_WRITE events on guest
sockets. The equeue polls the host socket for readiness on each wait
and reports the readable byte count or the send buffer size in data,
with EV_EOF on hang-up or error.