Zebediah Figura (@zfigura) commented about dlls/ntdll/sync.c:
+ } + + read.Ptr = InterlockedCompareExchangePointer(&lock->Ptr, new.Ptr, old.Ptr); + if (read.Ptr == old.Ptr) + break; + old = read; + } while (TRUE);
- if (!wait) return; - RtlWaitOnAddress( &u.s->owners, &new.s.owners, sizeof(short), NULL ); + while (TRUE) + { + /* waking up the waiter will invalidate the waiter's entry in + * the list. */ + struct srwlock_waiter *next = head->next; + InterlockedOr((LONG *)&head->state, SRWLOCK_WAITER_STATE_NOTIFIED); Does this actually need to be interlocked?
And, if so, we should just define "state" as a LONG type, avoiding the need to cast. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3504#note_43109