mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-12 15:44:20 +01:00
android: jni: native: Add lock around HaltEmulation, tighten run loop.
This commit is contained in:
parent
d553fd4c3a
commit
d6a41b3290
@ -126,6 +126,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HaltEmulation() {
|
void HaltEmulation() {
|
||||||
|
std::scoped_lock lock(mutex);
|
||||||
is_running = false;
|
is_running = false;
|
||||||
cv.notify_one();
|
cv.notify_one();
|
||||||
}
|
}
|
||||||
@ -145,7 +146,8 @@ public:
|
|||||||
while (true) {
|
while (true) {
|
||||||
{
|
{
|
||||||
std::unique_lock lock(mutex);
|
std::unique_lock lock(mutex);
|
||||||
if (cv.wait_for(lock, std::chrono::seconds(1), [&]() { return !is_running; })) {
|
if (cv.wait_for(lock, std::chrono::milliseconds(100),
|
||||||
|
[&]() { return !is_running; })) {
|
||||||
// Emulation halted.
|
// Emulation halted.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user