> The problem about this approach is that, semaphores are valuable kernel objects, and the maximum > number of HANDLEs that a process can open concurrently has a limit (like FDs on Linux), while 'many > critical sections are used only occasionally (or never at all), meaning the auto-reset event often > isn’t even necessary' [1], the semaphores are actually allocated on demand. This means that locking > can fail. There is a story in article [1] which also explains the origination of keyed events; it's > worth reading. This is not true for past 15 years, CRITICAL_SECTIONS use something like RtlWaitOnAddress (an equivalent of futexes) since Vista, see Wine implementation for details: https://gitlab.winehq.org/wine/wine/-/blob/master/dlls/ntdll/sync.c#L190 Jacek