diff options
| author | bunnei <bunneidev@gmail.com> | 2023-05-25 21:34:50 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-25 21:34:50 -0700 |
| commit | 83b502c08cf520166d09b8841f7b8874d35dce4f (patch) | |
| tree | 041901aad11e998b5424c50c6c5f29fef227ed11 /src/audio_core/renderer/system_manager.cpp | |
| parent | ffa1fba7d632d69e564cce302b5e5cf4bf131071 (diff) | |
| parent | d75bcdd07793954e6c33ba131871c183492b32b0 (diff) | |
Merge pull request #10221 from Kelebek1/partial_dsp_revert
Add a 5ms tiemout to the DSP processing wait
Diffstat (limited to 'src/audio_core/renderer/system_manager.cpp')
| -rw-r--r-- | src/audio_core/renderer/system_manager.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/audio_core/renderer/system_manager.cpp b/src/audio_core/renderer/system_manager.cpp index 07d8ed093..300ecdbf1 100644 --- a/src/audio_core/renderer/system_manager.cpp +++ b/src/audio_core/renderer/system_manager.cpp @@ -27,7 +27,7 @@ bool SystemManager::InitializeUnsafe() { if (!active) { if (adsp.Start()) { active = true; - thread = std::jthread([this](std::stop_token stop_token) { ThreadFunc(); }); + thread = std::jthread([this](std::stop_token stop_token) { ThreadFunc(stop_token); }); } } @@ -39,8 +39,7 @@ void SystemManager::Stop() { return; } active = false; - update.store(true); - update.notify_all(); + thread.request_stop(); thread.join(); adsp.Stop(); } @@ -85,12 +84,12 @@ bool SystemManager::Remove(System& system_) { return true; } -void SystemManager::ThreadFunc() { +void SystemManager::ThreadFunc(std::stop_token stop_token) { static constexpr char name[]{"AudioRenderSystemManager"}; MicroProfileOnThreadCreate(name); Common::SetCurrentThreadName(name); Common::SetCurrentThreadPriority(Common::ThreadPriority::High); - while (active) { + while (active && !stop_token.stop_requested()) { { std::scoped_lock l{mutex1}; |
