CoreTiming: Correct rebase bugs and other miscellaneous things.

This commit is contained in:
Fernando Sahmkow 2020-04-23 12:58:41 -04:00
parent cdf900f1e3
commit 71f1c0f9f9
2 changed files with 8 additions and 4 deletions

View file

@ -56,6 +56,7 @@ void CoreTiming::ThreadEntry(CoreTiming& instance) {
void CoreTiming::Initialize(std::function<void(void)>&& on_thread_init_) { void CoreTiming::Initialize(std::function<void(void)>&& on_thread_init_) {
on_thread_init = std::move(on_thread_init_); on_thread_init = std::move(on_thread_init_);
event_fifo_id = 0; event_fifo_id = 0;
shutting_down = false;
ticks = 0; ticks = 0;
const auto empty_timed_callback = [](u64, s64) {}; const auto empty_timed_callback = [](u64, s64) {};
ev_lost = CreateEvent("_lost_event", empty_timed_callback); ev_lost = CreateEvent("_lost_event", empty_timed_callback);
@ -79,6 +80,7 @@ void CoreTiming::Shutdown() {
void CoreTiming::Pause(bool is_paused) { void CoreTiming::Pause(bool is_paused) {
paused = is_paused; paused = is_paused;
pause_event.Set();
} }
void CoreTiming::SyncPause(bool is_paused) { void CoreTiming::SyncPause(bool is_paused) {

View file

@ -16,10 +16,10 @@
namespace { namespace {
// Numbers are chosen randomly to make sure the correct one is given. // Numbers are chosen randomly to make sure the correct one is given.
static constexpr std::array<u64, 5> CB_IDS{{42, 144, 93, 1026, UINT64_C(0xFFFF7FFFF7FFFF)}}; constexpr std::array<u64, 5> CB_IDS{{42, 144, 93, 1026, UINT64_C(0xFFFF7FFFF7FFFF)}};
static constexpr int MAX_SLICE_LENGTH = 10000; // Copied from CoreTiming internals constexpr int MAX_SLICE_LENGTH = 10000; // Copied from CoreTiming internals
static constexpr std::array<u64, 5> calls_order{{2, 0, 1, 4, 3}}; constexpr std::array<u64, 5> calls_order{{2, 0, 1, 4, 3}};
static std::array<s64, 5> delays{}; std::array<s64, 5> delays{};
std::bitset<CB_IDS.size()> callbacks_ran_flags; std::bitset<CB_IDS.size()> callbacks_ran_flags;
u64 expected_callback = 0; u64 expected_callback = 0;
@ -49,6 +49,8 @@ struct ScopeInit final {
Core::Timing::CoreTiming core_timing; Core::Timing::CoreTiming core_timing;
}; };
} // Anonymous namespace
TEST_CASE("CoreTiming[BasicOrder]", "[core]") { TEST_CASE("CoreTiming[BasicOrder]", "[core]") {
ScopeInit guard; ScopeInit guard;
auto& core_timing = guard.core_timing; auto& core_timing = guard.core_timing;