On Sat Dec 14 13:05:29 2024 +0000, Jinoh Kang wrote:
The problem is that there might be no threads that initiate any wait.
You're probably talking about GetQueuedCompletionStatus(). Sure, no threads might be waiting on IOCP. By "initiate the wait" I mean the wait on the (arbitrary) target object handle, not the IOCP. NtAssociateWaitCompletionPacket() initiates an *asynchronous* wait on the object handle. When the wait is done (the object is signaled), it queues a completion to the associated I/O completion port.
Note that this issue is currently masked by another omission in this MR: WaitCompletionPacket doesn't call obj->ops->satisfied().
Waiting on mutexes, semaphores, and auto-reset events have the side effect of acquiring or resetting their state. Your MR, in its current state, does _not_ let this side effect take place, rendering them useless.
Maybe, in the particular case of React Native, it only uses WaitCompletionPacket on manual reset events or other objects with no-op satisfied()? FWIW I couldn't find any reference to NtAssociateWaitCompletionPacket in https://github.com/facebook/react-native.