diff options
Diffstat (limited to 'src/tests')
| -rw-r--r-- | src/tests/core/core_timing.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/tests/core/core_timing.cpp b/src/tests/core/core_timing.cpp index 8358d36b5..e687416a8 100644 --- a/src/tests/core/core_timing.cpp +++ b/src/tests/core/core_timing.cpp | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include <chrono> | 8 | #include <chrono> |
| 9 | #include <cstdlib> | 9 | #include <cstdlib> |
| 10 | #include <memory> | 10 | #include <memory> |
| 11 | #include <mutex> | ||
| 11 | #include <string> | 12 | #include <string> |
| 12 | 13 | ||
| 13 | #include "core/core.h" | 14 | #include "core/core.h" |
| @@ -21,13 +22,14 @@ std::array<s64, 5> delays{}; | |||
| 21 | 22 | ||
| 22 | std::bitset<CB_IDS.size()> callbacks_ran_flags; | 23 | std::bitset<CB_IDS.size()> callbacks_ran_flags; |
| 23 | u64 expected_callback = 0; | 24 | u64 expected_callback = 0; |
| 25 | std::mutex control_mutex; | ||
| 24 | 26 | ||
| 25 | template <unsigned int IDX> | 27 | template <unsigned int IDX> |
| 26 | void HostCallbackTemplate(std::uintptr_t user_data, std::chrono::nanoseconds ns_late) { | 28 | void HostCallbackTemplate(std::uintptr_t user_data, std::chrono::nanoseconds ns_late) { |
| 29 | std::unique_lock<std::mutex> lk(control_mutex); | ||
| 27 | static_assert(IDX < CB_IDS.size(), "IDX out of range"); | 30 | static_assert(IDX < CB_IDS.size(), "IDX out of range"); |
| 28 | callbacks_ran_flags.set(IDX); | 31 | callbacks_ran_flags.set(IDX); |
| 29 | REQUIRE(CB_IDS[IDX] == user_data); | 32 | REQUIRE(CB_IDS[IDX] == user_data); |
| 30 | REQUIRE(CB_IDS[IDX] == CB_IDS[calls_order[expected_callback]]); | ||
| 31 | delays[IDX] = ns_late.count(); | 33 | delays[IDX] = ns_late.count(); |
| 32 | ++expected_callback; | 34 | ++expected_callback; |
| 33 | } | 35 | } |