summaryrefslogtreecommitdiff
path: root/src/yuzu/bootmanager.cpp
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-06-22 00:04:55 -0300
committerReinUsesLisp <reinuseslisp@airmail.cc>2021-06-22 00:04:57 -0300
commit4009ae1da2360f20721c93cd204eb64c7342eb53 (patch)
tree6bdd3084265212a096832f1e723c0c502f958f32 /src/yuzu/bootmanager.cpp
parent0485b8e84bacbf7fd56081822faca46114cbeb85 (diff)
bootmanager: Use std::stop_source for stopping emulation
Use its std::stop_token to abort shader cache loading. Using std::stop_token instead of std::atomic_bool allows the usage of other utilities like std::stop_callback.
Diffstat (limited to 'src/yuzu/bootmanager.cpp')
-rw-r--r--src/yuzu/bootmanager.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index 86495803e..7524e3c40 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -51,11 +51,11 @@ void EmuThread::run() {
Common::SetCurrentThreadName(name.c_str());
auto& system = Core::System::GetInstance();
+ auto& gpu = system.GPU();
+ auto stop_token = stop_source.get_token();
system.RegisterHostThread();
- auto& gpu = system.GPU();
-
// Main process has been loaded. Make the context current to this thread and begin GPU and CPU
// execution.
gpu.Start();
@@ -65,7 +65,7 @@ void EmuThread::run() {
emit LoadProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0);
system.Renderer().ReadRasterizer()->LoadDiskResources(
- system.CurrentProcess()->GetTitleID(), stop_run,
+ system.CurrentProcess()->GetTitleID(), stop_token,
[this](VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total) {
emit LoadProgress(stage, value, total);
});
@@ -78,7 +78,7 @@ void EmuThread::run() {
// so that the DebugModeLeft signal can be emitted before the
// next execution step
bool was_active = false;
- while (!stop_run) {
+ while (!stop_token.stop_requested()) {
if (running) {
if (was_active) {
emit DebugModeLeft();
@@ -100,7 +100,7 @@ void EmuThread::run() {
}
running_guard = false;
- if (!stop_run) {
+ if (!stop_token.stop_requested()) {
was_active = true;
emit DebugModeEntered();
}
@@ -108,7 +108,7 @@ void EmuThread::run() {
UNIMPLEMENTED();
} else {
std::unique_lock lock{running_mutex};
- running_cv.wait(lock, [this] { return IsRunning() || exec_step || stop_run; });
+ running_cv.wait(lock, stop_token, [this] { return IsRunning() || exec_step; });
}
}