3 ms·
WaitForMultipleObjects is problematic for a few reasons: * limited to 64 handles. * passes the entire handle buffer to the kernel on every call. That is also
by asveikau 7y ago
WaitForMultipleObjects is problematic for a few reasons:
* limited to 64 handles.
* passes the entire handle buffer to the kernel on every call. That is also a key reason poll is worse than epoll/kqueue. A better way is to let the kernel retain the list of handles across calls.
* when two handles are signalled, the one earlier in the array is always the one returned. So handle with a lower array index being frequently signalled can starve out your opportunity to process the later ones.
* since everything happens by returning an index, when multiple handles are signalled, you can only process one at a time, needing a new syscall for each.