Zebediah Figura (@zfigura) commented about dlls/ntdll/sync.c:
- if (!old.s.owners) - { - /* Not locked exclusive or shared. We can try to grab it. */ - new.s.owners = -1; - --new.s.exclusive_waiters; - wait = FALSE; - } - else - { - wait = TRUE; - } - } while (InterlockedCompareExchange( u.l, new.l, old.l ) != old.l); + TRACE("new = %p, #owners = %ld\n", new.Ptr, shared_owner_count); + read.Ptr = InterlockedCompareExchangePointer(&lock->Ptr, new.Ptr, expected.Ptr); + if (read.Ptr != expected.Ptr)
This part I do hate, though. Do we really need srwlock_wake() to work without the spinlock held? We're already holding it in srwlock_maybe_wake() anyway... -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3504#note_46116