summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/kernel.h
diff options
context:
space:
mode:
authorGravatar bunnei2015-01-14 19:22:50 -0500
committerGravatar bunnei2015-01-21 18:41:00 -0500
commitc22bac6398ff1705992fc44b2c29775c84cff662 (patch)
treee20da7e6e1824c19b7ced73f43815397749ffae7 /src/core/hle/kernel/kernel.h
parentMerge pull request #491 from archshift/hidspvr (diff)
downloadyuzu-c22bac6398ff1705992fc44b2c29775c84cff662.tar.gz
yuzu-c22bac6398ff1705992fc44b2c29775c84cff662.tar.xz
yuzu-c22bac6398ff1705992fc44b2c29775c84cff662.zip
Kernel: Added WaitObject and changed "waitable" objects inherit from it.
Diffstat (limited to 'src/core/hle/kernel/kernel.h')
-rw-r--r--src/core/hle/kernel/kernel.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index 5e5217b78..a9af9de88 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -8,6 +8,8 @@
8 8
9#include <array> 9#include <array>
10#include <string> 10#include <string>
11#include <vector>
12
11#include "common/common.h" 13#include "common/common.h"
12#include "core/hle/result.h" 14#include "core/hle/result.h"
13 15
@@ -92,6 +94,29 @@ inline void intrusive_ptr_release(Object* object) {
92template <typename T> 94template <typename T>
93using SharedPtr = boost::intrusive_ptr<T>; 95using SharedPtr = boost::intrusive_ptr<T>;
94 96
97/// Class that represents a Kernel object that a thread can be waiting on
98class WaitObject : public Object {
99public:
100
101 /**
102 * Add a thread to wait on this object
103 * @param thread Pointer to thread to add
104 */
105 void AddWaitingThread(Thread* thread);
106
107 /**
108 * Resumes the next thread waiting on this object
109 * @return Pointer to the thread that was resumed, nullptr if no threads are waiting
110 */
111 Thread* ResumeNextThread();
112
113 /// Releases all threads waiting on this object
114 void ReleaseAllWaitingThreads();
115
116private:
117 std::vector<Thread*> waiting_threads; ///< Threads waiting for this object to become available
118};
119
95/** 120/**
96 * This class allows the creation of Handles, which are references to objects that can be tested 121 * This class allows the creation of Handles, which are references to objects that can be tested
97 * for validity and looked up. Here they are used to pass references to kernel objects to/from the 122 * for validity and looked up. Here they are used to pass references to kernel objects to/from the