diff options
| author | 2020-03-10 11:50:33 -0400 | |
|---|---|---|
| committer | 2020-06-27 11:35:43 -0400 | |
| commit | a439cdf22ea50f0e39cb51f6dff15fee3b495d16 (patch) | |
| tree | 2c88310d7cca08ef451107d9ae6bd5191e7d72e5 /src/core/cpu_manager.h | |
| parent | Synchronization: Correct wide Assertion. (diff) | |
| download | yuzu-a439cdf22ea50f0e39cb51f6dff15fee3b495d16.tar.gz yuzu-a439cdf22ea50f0e39cb51f6dff15fee3b495d16.tar.xz yuzu-a439cdf22ea50f0e39cb51f6dff15fee3b495d16.zip | |
CPU_Manager: Unload/Reload threads on preemption on SingleCore
Diffstat (limited to 'src/core/cpu_manager.h')
| -rw-r--r-- | src/core/cpu_manager.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/cpu_manager.h b/src/core/cpu_manager.h index 1e81481ec..ff1935d5c 100644 --- a/src/core/cpu_manager.h +++ b/src/core/cpu_manager.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <atomic> | ||
| 8 | #include <functional> | 9 | #include <functional> |
| 9 | #include <memory> | 10 | #include <memory> |
| 10 | #include <thread> | 11 | #include <thread> |
| @@ -45,7 +46,7 @@ public: | |||
| 45 | void* GetStartFuncParamater(); | 46 | void* GetStartFuncParamater(); |
| 46 | 47 | ||
| 47 | std::size_t CurrentCore() const { | 48 | std::size_t CurrentCore() const { |
| 48 | return current_core; | 49 | return current_core.load(); |
| 49 | } | 50 | } |
| 50 | 51 | ||
| 51 | private: | 52 | private: |
| @@ -88,7 +89,7 @@ private: | |||
| 88 | std::array<CoreData, Core::Hardware::NUM_CPU_CORES> core_data{}; | 89 | std::array<CoreData, Core::Hardware::NUM_CPU_CORES> core_data{}; |
| 89 | 90 | ||
| 90 | bool is_multicore{}; | 91 | bool is_multicore{}; |
| 91 | std::size_t current_core{}; | 92 | std::atomic<std::size_t> current_core{}; |
| 92 | std::size_t preemption_count{}; | 93 | std::size_t preemption_count{}; |
| 93 | static constexpr std::size_t max_cycle_runs = 5; | 94 | static constexpr std::size_t max_cycle_runs = 5; |
| 94 | 95 | ||