Zebediah Figura (@zfigura) commented about dlls/ntdll/sync.c:
+ record.ExceptionFlags = 0; + record.ExceptionRecord = NULL; + record.NumberParameters = 0; + return RtlRaiseException(&record); } - else + + if (tag & SRWLOCK_TAG_HAS_WAITERS) { - ret = FALSE; + /* We are only safe to access the list head if there are multiple owners, + * in which case only after the last owner has decremented `num_owners` + * can the list starts to be modified. OTOH when the HAS_MULTIPLE_OWNERS + * bit is not set, we know we are the sole owner without needing to + * consult the list. */ + if (tag & SRWLOCK_TAG_HAS_MULTIPLE_OWNERS) Wait, why can't we access the list head if we're the last owner? Nobody can wake the lock other than us, right?
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3504#note_46114