From 65bfc1469e31cc8cf49f352ef62894c8e17b15e0 Mon Sep 17 00:00:00 2001 From: Thom Chiovoloni Date: Thu, 31 Dec 2020 11:40:56 -0800 Subject: [PATCH] Use `compare_exchange` and not `compare_and_swap` --- imgui-winit-support/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/imgui-winit-support/src/lib.rs b/imgui-winit-support/src/lib.rs index 2cd42f6..191fe32 100644 --- a/imgui-winit-support/src/lib.rs +++ b/imgui-winit-support/src/lib.rs @@ -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);