summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2017-12-29 05:12:28 +0100
committerbunnei <bunneidev@gmail.com>2017-12-29 05:12:28 +0100
commit834fa5db65ab3bc2e05474e280f5a0a73be7411e (patch)
tree3c1557cb761e6c53f6305b6ec349a01cc6438eb3 /src/core/hle/kernel
parentsvc: Implement MapMemory. (diff)
downloadyuzu-834fa5db65ab3bc2e05474e280f5a0a73be7411e.tar
yuzu-834fa5db65ab3bc2e05474e280f5a0a73be7411e.tar.gz
yuzu-834fa5db65ab3bc2e05474e280f5a0a73be7411e.tar.bz2
yuzu-834fa5db65ab3bc2e05474e280f5a0a73be7411e.tar.lz
yuzu-834fa5db65ab3bc2e05474e280f5a0a73be7411e.tar.xz
yuzu-834fa5db65ab3bc2e05474e280f5a0a73be7411e.tar.zst
yuzu-834fa5db65ab3bc2e05474e280f5a0a73be7411e.zip
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/client_session.h11
-rw-r--r--src/core/hle/kernel/sync_object.h35
2 files changed, 38 insertions, 8 deletions
diff --git a/src/core/hle/kernel/client_session.h b/src/core/hle/kernel/client_session.h
index daf521529..671174ec4 100644
--- a/src/core/hle/kernel/client_session.h
+++ b/src/core/hle/kernel/client_session.h
@@ -7,7 +7,7 @@
#include <memory>
#include <string>
#include "common/common_types.h"
-#include "core/hle/kernel/kernel.h"
+#include "core/hle/kernel/sync_object.h"
#include "core/hle/result.h"
namespace Kernel {
@@ -16,7 +16,7 @@ class ServerSession;
class Session;
class Thread;
-class ClientSession final : public Object {
+class ClientSession final : public SyncObject {
public:
friend class ServerSession;
@@ -33,12 +33,7 @@ public:
return HANDLE_TYPE;
}
- /**
- * Sends an SyncRequest from the current emulated thread.
- * @param thread Thread that initiated the request.
- * @return ResultCode of the operation.
- */
- ResultCode SendSyncRequest(SharedPtr<Thread> thread);
+ ResultCode SendSyncRequest(SharedPtr<Thread> thread) override;
std::string name; ///< Name of client port (optional)
diff --git a/src/core/hle/kernel/sync_object.h b/src/core/hle/kernel/sync_object.h
new file mode 100644
index 000000000..ce2835ca4
--- /dev/null
+++ b/src/core/hle/kernel/sync_object.h
@@ -0,0 +1,35 @@
+// Copyright 2017 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <boost/smart_ptr/intrusive_ptr.hpp>
+#include "core/hle/kernel/kernel.h"
+#include "core/hle/result.h"
+
+namespace Kernel {
+
+class Thread;
+
+/// Class that represents a Kernel object that svcSendSyncRequest can be called on
+class SyncObject : public Object {
+public:
+ /**
+ * Handle a sync request from the emulated application.
+ * @param thread Thread that initiated the request.
+ * @returns ResultCode from the operation.
+ */
+ virtual ResultCode SendSyncRequest(SharedPtr<Thread> thread) = 0;
+};
+
+// Specialization of DynamicObjectCast for SyncObjects
+template <>
+inline SharedPtr<SyncObject> DynamicObjectCast<SyncObject>(SharedPtr<Object> object) {
+ if (object != nullptr && object->IsSyncable()) {
+ return boost::static_pointer_cast<SyncObject>(std::move(object));
+ }
+ return nullptr;
+}
+
+} // namespace Kernel