summaryrefslogtreecommitdiffstats
path: root/src/core/cpu_manager.h
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-01-26 19:07:22 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-01-26 19:07:22 +0100
commite4a1ead897575ee9222b4fc1021aaa9cc58f12c8 (patch)
treeef544a51ba2480400df62d40706f68fa3ae62693 /src/core/cpu_manager.h
parentArmInterface: Delegate Exclusive monitor factory to exclusive monitor interfasce. (diff)
downloadyuzu-e4a1ead897575ee9222b4fc1021aaa9cc58f12c8.tar
yuzu-e4a1ead897575ee9222b4fc1021aaa9cc58f12c8.tar.gz
yuzu-e4a1ead897575ee9222b4fc1021aaa9cc58f12c8.tar.bz2
yuzu-e4a1ead897575ee9222b4fc1021aaa9cc58f12c8.tar.lz
yuzu-e4a1ead897575ee9222b4fc1021aaa9cc58f12c8.tar.xz
yuzu-e4a1ead897575ee9222b4fc1021aaa9cc58f12c8.tar.zst
yuzu-e4a1ead897575ee9222b4fc1021aaa9cc58f12c8.zip
Diffstat (limited to 'src/core/cpu_manager.h')
-rw-r--r--src/core/cpu_manager.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/core/cpu_manager.h b/src/core/cpu_manager.h
new file mode 100644
index 000000000..5371d448e
--- /dev/null
+++ b/src/core/cpu_manager.h
@@ -0,0 +1,52 @@
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <array>
+#include <map>
+#include <memory>
+#include <thread>
+
+namespace Core {
+
+class CoreManager;
+class System;
+
+class CpuManager {
+public:
+ explicit CpuManager(System& system);
+ CpuManager(const CpuManager&) = delete;
+ CpuManager(CpuManager&&) = delete;
+
+ ~CpuManager();
+
+ CpuManager& operator=(const CpuManager&) = delete;
+ CpuManager& operator=(CpuManager&&) = delete;
+
+ void Initialize();
+ void Shutdown();
+
+ CoreManager& GetCoreManager(std::size_t index);
+ const CoreManager& GetCoreManager(std::size_t index) const;
+
+ CoreManager& GetCurrentCoreManager();
+ const CoreManager& GetCurrentCoreManager() const;
+
+ std::size_t GetActiveCoreIndex() const {
+ return active_core;
+ }
+
+ void RunLoop(bool tight_loop);
+
+private:
+ static constexpr std::size_t NUM_CPU_CORES = 4;
+
+ std::array<std::unique_ptr<CoreManager>, NUM_CPU_CORES> core_managers;
+ std::size_t active_core{}; ///< Active core, only used in single thread mode
+
+ System& system;
+};
+
+} // namespace Core