summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-01-12 05:49:11 +0100
committerbunnei <bunneidev@gmail.com>2022-01-14 06:26:10 +0100
commit2147240e47d2ea98d43369f30ffc066900c80991 (patch)
tree6b31ffdb80f0ec3db90d58e30ebe5ef848372914 /src
parentMerge pull request #7690 from Morph1984/increase-file-limit-win (diff)
downloadyuzu-2147240e47d2ea98d43369f30ffc066900c80991.tar
yuzu-2147240e47d2ea98d43369f30ffc066900c80991.tar.gz
yuzu-2147240e47d2ea98d43369f30ffc066900c80991.tar.bz2
yuzu-2147240e47d2ea98d43369f30ffc066900c80991.tar.lz
yuzu-2147240e47d2ea98d43369f30ffc066900c80991.tar.xz
yuzu-2147240e47d2ea98d43369f30ffc066900c80991.tar.zst
yuzu-2147240e47d2ea98d43369f30ffc066900c80991.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/kernel.cpp34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 1225e1fba..e1e17db13 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -121,7 +121,7 @@ struct KernelCore::Impl {
object_list_container.Finalize();
// Ensures all service threads gracefully shutdown.
- service_threads.clear();
+ ClearServiceThreads();
next_object_id = 0;
next_kernel_process_id = KProcess::InitialKIPIDMin;
@@ -704,11 +704,35 @@ struct KernelCore::Impl {
return port;
}
+ std::weak_ptr<Kernel::ServiceThread> CreateServiceThread(KernelCore& kernel,
+ const std::string& name) {
+ auto service_thread = std::make_shared<Kernel::ServiceThread>(kernel, 1, name);
+ {
+ std::lock_guard lk(service_threads_lock);
+ service_threads.emplace(service_thread);
+ }
+ return service_thread;
+ }
+
+ void ReleaseServiceThread(std::weak_ptr<Kernel::ServiceThread> service_thread) {
+ auto strong_ptr = service_thread.lock();
+ {
+ std::lock_guard lk(service_threads_lock);
+ service_threads.erase(strong_ptr);
+ }
+ }
+
+ void ClearServiceThreads() {
+ std::lock_guard lk(service_threads_lock);
+ service_threads.clear();
+ }
+
std::mutex server_ports_lock;
std::mutex server_sessions_lock;
std::mutex registered_objects_lock;
std::mutex registered_in_use_objects_lock;
std::mutex dummy_thread_lock;
+ std::mutex service_threads_lock;
std::atomic<u32> next_object_id{0};
std::atomic<u64> next_kernel_process_id{KProcess::InitialKIPIDMin};
@@ -1099,15 +1123,11 @@ void KernelCore::ExitSVCProfile() {
}
std::weak_ptr<Kernel::ServiceThread> KernelCore::CreateServiceThread(const std::string& name) {
- auto service_thread = std::make_shared<Kernel::ServiceThread>(*this, 1, name);
- impl->service_threads.emplace(service_thread);
- return service_thread;
+ return impl->CreateServiceThread(*this, name);
}
void KernelCore::ReleaseServiceThread(std::weak_ptr<Kernel::ServiceThread> service_thread) {
- if (auto strong_ptr = service_thread.lock()) {
- impl->service_threads.erase(strong_ptr);
- }
+ impl->ReleaseServiceThread(service_thread);
}
Init::KSlabResourceCounts& KernelCore::SlabResourceCounts() {