diff --git a/src/xenia/base/testing/threading_test.cc b/src/xenia/base/testing/threading_test.cc index 22db31cbf..f19af2647 100644 --- a/src/xenia/base/testing/threading_test.cc +++ b/src/xenia/base/testing/threading_test.cc @@ -14,6 +14,8 @@ #define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER #include "third_party/catch/include/catch.hpp" +#include "third_party/disruptorplus/include/disruptorplus/spin_wait.hpp" + namespace xe { namespace base { namespace test { @@ -25,12 +27,12 @@ template bool spin_wait_until( const std::chrono::time_point& timeout_time, Predicate stop_waiting) { + disruptorplus::spin_wait spinner; while (!stop_waiting()) { if (std::chrono::steady_clock::now() >= timeout_time) { return false; } - // Needed for valgrind because it basically runs one thread: - MaybeYield(); + spinner.spin_once(); } return true; } @@ -43,9 +45,9 @@ bool spin_wait_for(const std::chrono::duration& rel_time, template void spin_wait(Predicate stop_waiting) { + disruptorplus::spin_wait spinner; while (!stop_waiting()) { - // Needed for valgrind because it basically runs one thread: - MaybeYield(); + spinner.spin_once(); } }