diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/android/app/src/main/jni/native.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index d0794e8b1..f1a70c35c 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp | |||
| @@ -61,7 +61,7 @@ public: | |||
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | bool IsRunning() const { | 63 | bool IsRunning() const { |
| 64 | return is_running.load(std::memory_order_relaxed); | 64 | return is_running; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | const Core::PerfStatsResults& PerfStats() const { | 67 | const Core::PerfStatsResults& PerfStats() const { |
| @@ -125,14 +125,14 @@ public: | |||
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | void HaltEmulation() { | 127 | void HaltEmulation() { |
| 128 | is_running.store(false, std::memory_order_relaxed); | 128 | is_running = false; |
| 129 | cv.notify_one(); | 129 | cv.notify_one(); |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | void RunEmulation() { | 132 | void RunEmulation() { |
| 133 | std::unique_lock lock(mutex); | 133 | std::unique_lock lock(mutex); |
| 134 | 134 | ||
| 135 | is_running.store(true, std::memory_order_relaxed); | 135 | is_running = true; |
| 136 | 136 | ||
| 137 | void(system.Run()); | 137 | void(system.Run()); |
| 138 | 138 | ||
| @@ -140,8 +140,7 @@ public: | |||
| 140 | system.InitializeDebugger(); | 140 | system.InitializeDebugger(); |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | while (!cv.wait_for(lock, std::chrono::seconds(1), | 143 | while (!cv.wait_for(lock, std::chrono::seconds(1), [&]() { return !is_running; })) { |
| 144 | [&]() { return !is_running.load(std::memory_order_relaxed); })) { | ||
| 145 | std::scoped_lock perf_stats_lock(perf_stats_mutex); | 144 | std::scoped_lock perf_stats_lock(perf_stats_mutex); |
| 146 | perf_stats = system.GetAndResetPerfStats(); | 145 | perf_stats = system.GetAndResetPerfStats(); |
| 147 | } | 146 | } |
| @@ -162,7 +161,7 @@ private: | |||
| 162 | std::unique_ptr<EmuWindow_Android> window; | 161 | std::unique_ptr<EmuWindow_Android> window; |
| 163 | std::mutex mutex; | 162 | std::mutex mutex; |
| 164 | std::condition_variable_any cv; | 163 | std::condition_variable_any cv; |
| 165 | std::atomic_bool is_running{}; | 164 | bool is_running{}; |
| 166 | }; | 165 | }; |
| 167 | 166 | ||
| 168 | /*static*/ EmulationSession EmulationSession::s_instance; | 167 | /*static*/ EmulationSession EmulationSession::s_instance; |