Remove pause callbacks from coretiming

This commit is contained in:
Kelebek1 2022-09-10 21:14:03 +01:00
parent cd4b9bffb2
commit e93e898df5
15 changed files with 29 additions and 144 deletions

View file

@ -141,8 +141,6 @@ struct System::Impl {
core_timing.SyncPause(false);
is_paused = false;
audio_core->PauseSinks(false);
return status;
}
@ -150,8 +148,6 @@ struct System::Impl {
std::unique_lock<std::mutex> lk(suspend_guard);
status = SystemResultStatus::Success;
audio_core->PauseSinks(true);
core_timing.SyncPause(true);
kernel.Suspend(true);
is_paused = true;

View file

@ -73,7 +73,6 @@ void CoreTiming::Shutdown() {
if (timer_thread) {
timer_thread->join();
}
pause_callbacks.clear();
ClearPendingEvents();
timer_thread.reset();
has_started = false;
@ -86,10 +85,6 @@ void CoreTiming::Pause(bool is_paused) {
if (!is_paused) {
pause_end_time = GetGlobalTimeNs().count();
}
for (auto& cb : pause_callbacks) {
cb(is_paused);
}
}
void CoreTiming::SyncPause(bool is_paused) {
@ -110,10 +105,6 @@ void CoreTiming::SyncPause(bool is_paused) {
if (!is_paused) {
pause_end_time = GetGlobalTimeNs().count();
}
for (auto& cb : pause_callbacks) {
cb(is_paused);
}
}
bool CoreTiming::IsRunning() const {
@ -219,11 +210,6 @@ void CoreTiming::RemoveEvent(const std::shared_ptr<EventType>& event_type) {
}
}
void CoreTiming::RegisterPauseCallback(PauseCallback&& callback) {
std::scoped_lock lock{basic_lock};
pause_callbacks.emplace_back(std::move(callback));
}
std::optional<s64> CoreTiming::Advance() {
std::scoped_lock lock{advance_lock, basic_lock};
global_timer = GetGlobalTimeNs().count();

View file

@ -22,7 +22,6 @@ namespace Core::Timing {
/// A callback that may be scheduled for a particular core timing event.
using TimedCallback = std::function<std::optional<std::chrono::nanoseconds>(
std::uintptr_t user_data, s64 time, std::chrono::nanoseconds ns_late)>;
using PauseCallback = std::function<void(bool paused)>;
/// Contains the characteristics of a particular event.
struct EventType {
@ -134,9 +133,6 @@ public:
/// Checks for events manually and returns time in nanoseconds for next event, threadsafe.
std::optional<s64> Advance();
/// Register a callback function to be called when coretiming pauses.
void RegisterPauseCallback(PauseCallback&& callback);
private:
struct Event;
@ -176,8 +172,6 @@ private:
/// Cycle timing
u64 ticks{};
s64 downcount{};
std::vector<PauseCallback> pause_callbacks{};
};
/// Creates a core timing event with the given name and callback.