summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/service.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-12-29 03:23:42 +0100
committerbunnei <bunneidev@gmail.com>2020-12-29 06:33:34 +0100
commit7d77a3f88f7a1e68d9846ca7c69cce051d1a33d2 (patch)
treebe882bb9b5d144861673178a1fdaad9a19504c5a /src/core/hle/service/service.h
parentaudio_core: stream: Ensure buffer is valid before release. (diff)
downloadyuzu-7d77a3f88f7a1e68d9846ca7c69cce051d1a33d2.tar
yuzu-7d77a3f88f7a1e68d9846ca7c69cce051d1a33d2.tar.gz
yuzu-7d77a3f88f7a1e68d9846ca7c69cce051d1a33d2.tar.bz2
yuzu-7d77a3f88f7a1e68d9846ca7c69cce051d1a33d2.tar.lz
yuzu-7d77a3f88f7a1e68d9846ca7c69cce051d1a33d2.tar.xz
yuzu-7d77a3f88f7a1e68d9846ca7c69cce051d1a33d2.tar.zst
yuzu-7d77a3f88f7a1e68d9846ca7c69cce051d1a33d2.zip
Diffstat (limited to 'src/core/hle/service/service.h')
-rw-r--r--src/core/hle/service/service.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index 62a182310..916445517 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -5,9 +5,11 @@
#pragma once
#include <cstddef>
+#include <mutex>
#include <string>
#include <boost/container/flat_map.hpp>
#include "common/common_types.h"
+#include "common/spin_lock.h"
#include "core/hle/kernel/hle_ipc.h"
#include "core/hle/kernel/object.h"
@@ -68,11 +70,9 @@ public:
void InstallAsService(SM::ServiceManager& service_manager);
/// Creates a port pair and registers it on the kernel's global port registry.
void InstallAsNamedPort(Kernel::KernelCore& kernel);
- /// Creates and returns an unregistered port for the service.
- std::shared_ptr<Kernel::ClientPort> CreatePort(Kernel::KernelCore& kernel);
-
+ /// Invokes a service request routine.
void InvokeRequest(Kernel::HLERequestContext& ctx);
-
+ /// Handles a synchronization request for the service.
ResultCode HandleSyncRequest(Kernel::HLERequestContext& context) override;
protected:
@@ -80,6 +80,11 @@ protected:
template <typename Self>
using HandlerFnP = void (Self::*)(Kernel::HLERequestContext&);
+ /// Used to gain exclusive access to the service members, e.g. from CoreTiming thread.
+ [[nodiscard]] std::scoped_lock<Common::SpinLock> LockService() {
+ return std::scoped_lock{lock_service};
+ }
+
/// System context that the service operates under.
Core::System& system;
@@ -115,6 +120,9 @@ private:
/// Function used to safely up-cast pointers to the derived class before invoking a handler.
InvokerFn* handler_invoker;
boost::container::flat_map<u32, FunctionInfoBase> handlers;
+
+ /// Used to gain exclusive access to the service members, e.g. from CoreTiming thread.
+ Common::SpinLock lock_service;
};
/**