From cc4cfc7ef23414f2dd39f0ed09f32526aea04089 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Tue, 2 May 2023 15:57:16 -0700 Subject: [PATCH] Fix bug in swap_test iteration logic that caused early termination of the swap loop --- test/cfoa/swap_tests.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/cfoa/swap_tests.cpp b/test/cfoa/swap_tests.cpp index 9fae85cd..b5c2bd08 100644 --- a/test/cfoa/swap_tests.cpp +++ b/test/cfoa/swap_tests.cpp @@ -191,7 +191,6 @@ namespace { if (idx % 100 == 0) { cv.notify_all(); } - std::this_thread::yield(); } done1 = true; @@ -202,7 +201,6 @@ namespace { for (auto const& val : vals2) { x2.insert(val); - std::this_thread::yield(); } done2 = true; @@ -216,8 +214,7 @@ namespace { } x1.swap(x2); ++num_swaps; - std::this_thread::yield(); - } while (!done1 && !done2); + } while (!done1 || !done2); }); t1.join();