Use compare_exchange and not compare_and_swap

This commit is contained in:
Thom Chiovoloni 2020-12-31 11:40:56 -08:00
parent eada611c2c
commit 65bfc1469e

View File

@ -199,7 +199,11 @@ fn check_multiple_winits() {
// Note that the `Ordering` basically doesn't matter here, but even if it
// did, `Relaxed` is still correct because we're only interested in the
// effects on a single atomic variable.
if winits_enabled <= 1 || COMPLAINED.compare_and_swap(false, true, Ordering::Relaxed) {
if winits_enabled <= 1
|| COMPLAINED
.compare_exchange(false, true, Ordering::Relaxed, Ordering::Relaxed)
.is_err()
{
return;
}
let mut err = Vec::with_capacity(512);