diff options
author | Liam <byteslice@airmail.cc> | 2023-06-04 18:56:40 +0200 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2023-06-04 19:00:10 +0200 |
commit | e96a3a171355323453bf0689b80e9b2279750495 (patch) | |
tree | 6c44cc3407c887b1bd4bcdaec321123932a07ca7 /src/audio_core/renderer/adsp | |
parent | Merge pull request #10588 from liamwhite/vfs-cached (diff) | |
download | yuzu-e96a3a171355323453bf0689b80e9b2279750495.tar yuzu-e96a3a171355323453bf0689b80e9b2279750495.tar.gz yuzu-e96a3a171355323453bf0689b80e9b2279750495.tar.bz2 yuzu-e96a3a171355323453bf0689b80e9b2279750495.tar.lz yuzu-e96a3a171355323453bf0689b80e9b2279750495.tar.xz yuzu-e96a3a171355323453bf0689b80e9b2279750495.tar.zst yuzu-e96a3a171355323453bf0689b80e9b2279750495.zip |
Diffstat (limited to '')
-rw-r--r-- | src/audio_core/renderer/adsp/audio_renderer.cpp | 8 | ||||
-rw-r--r-- | src/audio_core/renderer/adsp/audio_renderer.h | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/audio_core/renderer/adsp/audio_renderer.cpp b/src/audio_core/renderer/adsp/audio_renderer.cpp index 1cbeed302..8bc39f9f9 100644 --- a/src/audio_core/renderer/adsp/audio_renderer.cpp +++ b/src/audio_core/renderer/adsp/audio_renderer.cpp @@ -105,7 +105,7 @@ void AudioRenderer::Start(AudioRenderer_Mailbox* mailbox_) { } mailbox = mailbox_; - thread = std::thread(&AudioRenderer::ThreadFunc, this); + thread = std::jthread([this](std::stop_token stop_token) { ThreadFunc(stop_token); }); running = true; } @@ -131,7 +131,7 @@ void AudioRenderer::CreateSinkStreams() { } } -void AudioRenderer::ThreadFunc() { +void AudioRenderer::ThreadFunc(std::stop_token stop_token) { static constexpr char name[]{"AudioRenderer"}; MicroProfileOnThreadCreate(name); Common::SetCurrentThreadName(name); @@ -146,7 +146,7 @@ void AudioRenderer::ThreadFunc() { constexpr u64 max_process_time{2'304'000ULL}; - while (true) { + while (!stop_token.stop_requested()) { auto message{mailbox->ADSPWaitMessage()}; switch (message) { case RenderMessage::AudioRenderer_Shutdown: @@ -194,7 +194,7 @@ void AudioRenderer::ThreadFunc() { max_time = std::min(command_buffer.time_limit, max_time); command_list_processor.SetProcessTimeMax(max_time); - streams[index]->WaitFreeSpace(); + streams[index]->WaitFreeSpace(stop_token); // Process the command list { diff --git a/src/audio_core/renderer/adsp/audio_renderer.h b/src/audio_core/renderer/adsp/audio_renderer.h index 85ce6a269..88e558183 100644 --- a/src/audio_core/renderer/adsp/audio_renderer.h +++ b/src/audio_core/renderer/adsp/audio_renderer.h @@ -177,7 +177,7 @@ private: /** * Main AudioRenderer thread, responsible for processing the command lists. */ - void ThreadFunc(); + void ThreadFunc(std::stop_token stop_token); /** * Creates the streams which will receive the processed samples. @@ -187,7 +187,7 @@ private: /// Core system Core::System& system; /// Main thread - std::thread thread{}; + std::jthread thread{}; /// The current state std::atomic<bool> running{}; /// The active mailbox |