Fix compare_and_swap in Windows thread_parker

This commit is contained in:
Linus Färnstrand 2020-12-22 12:24:17 +01:00
parent 3eef20ffa0
commit 865e4797df

View File

@ -113,7 +113,7 @@ impl Parker {
// Wait for something to happen, assuming it's still set to PARKED.
c::WaitOnAddress(self.ptr(), &PARKED as *const _ as c::LPVOID, 1, c::INFINITE);
// Change NOTIFIED=>EMPTY but leave PARKED alone.
if self.state.compare_and_swap(NOTIFIED, EMPTY, Acquire) == NOTIFIED {
if self.state.compare_exchange(NOTIFIED, EMPTY, Acquire, Acquire) == NOTIFIED {
// Actually woken up by unpark().
return;
} else {