Zebediah Figura (@zfigura) commented about dlls/ntdll/sync.c:
+ if (srwlock_wait(lock, 0, old)) + break; +} + +/* Try to acquire the list lock and start waking waiters up. + * + * This function bails in the following cases: + * + * - the lock become locked, we should not try to wake anyone up. And the + * new owner of the lock will be doing the waking when it releases the + * lock. + * - someone else acquired the list lock. In this case they will be responsible + * of waking up the waiters. + * - no waiters remain. No one to wake up. + */ +static void srwlock_maybe_wake(RTL_SRWLOCK *lock, RTL_SRWLOCK old) This is... complex, although not complex enough that I hate it.
Did you try a variant where we just always grab the spinlock when waking? Was that not performant enough? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3504#note_46115