summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
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 @@
7#include <memory> 7#include <memory>
8#include <string> 8#include <string>
9#include "common/common_types.h" 9#include "common/common_types.h"
10#include "core/hle/kernel/kernel.h" 10#include "core/hle/kernel/sync_object.h"
11#include "core/hle/result.h" 11#include "core/hle/result.h"
12 12
13namespace Kernel { 13namespace Kernel {
@@ -16,7 +16,7 @@ class ServerSession;
16class Session; 16class Session;
17class Thread; 17class Thread;
18 18
19class ClientSession final : public Object { 19class ClientSession final : public SyncObject {
20public: 20public:
21 friend class ServerSession; 21 friend class ServerSession;
22 22
@@ -33,12 +33,7 @@ public:
33 return HANDLE_TYPE; 33 return HANDLE_TYPE;
34 } 34 }
35 35
36 /** 36 ResultCode SendSyncRequest(SharedPtr<Thread> thread) override;
37 * Sends an SyncRequest from the current emulated thread.
38 * @param thread Thread that initiated the request.
39 * @return ResultCode of the operation.
40 */
41 ResultCode SendSyncRequest(SharedPtr<Thread> thread);
42 37
43 std::string name; ///< Name of client port (optional) 38 std::string name; ///< Name of client port (optional)
44 39
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 @@
1// Copyright 2017 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <boost/smart_ptr/intrusive_ptr.hpp>
8#include "core/hle/kernel/kernel.h"
9#include "core/hle/result.h"
10
11namespace Kernel {
12
13class Thread;
14
15/// Class that represents a Kernel object that svcSendSyncRequest can be called on
16class SyncObject : public Object {
17public:
18 /**
19 * Handle a sync request from the emulated application.
20 * @param thread Thread that initiated the request.
21 * @returns ResultCode from the operation.
22 */
23 virtual ResultCode SendSyncRequest(SharedPtr<Thread> thread) = 0;
24};
25
26// Specialization of DynamicObjectCast for SyncObjects
27template <>
28inline SharedPtr<SyncObject> DynamicObjectCast<SyncObject>(SharedPtr<Object> object) {
29 if (object != nullptr && object->IsSyncable()) {
30 return boost::static_pointer_cast<SyncObject>(std::move(object));
31 }
32 return nullptr;
33}
34
35} // namespace Kernel