aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/hle/kernel/kernel.h
diff options
context:
space:
mode:
authorGravatar bunnei <bunneidev@gmail.com>2015-01-14 19:22:50 -0500
committerGravatar bunnei <bunneidev@gmail.com>2015-01-21 18:41:00 -0500
commitc22bac6398ff1705992fc44b2c29775c84cff662 (patch)
treee20da7e6e1824c19b7ced73f43815397749ffae7 /src/core/hle/kernel/kernel.h
parent0c7498545f7f9beeb7e8070e1a1955a8d6f40bb6 (diff)
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 5e5217b7..a9af9de8 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -8,6 +8,8 @@
#include <array>
#include <string>
+#include <vector>
+
#include "common/common.h"
#include "core/hle/result.h"
@@ -92,6 +94,29 @@ inline void intrusive_ptr_release(Object* object) {
template <typename T>
using SharedPtr = boost::intrusive_ptr<T>;
+/// Class that represents a Kernel object that a thread can be waiting on
+class WaitObject : public Object {
+public:
+
+ /**
+ * Add a thread to wait on this object
+ * @param thread Pointer to thread to add
+ */
+ void AddWaitingThread(Thread* thread);
+
+ /**
+ * Resumes the next thread waiting on this object
+ * @return Pointer to the thread that was resumed, nullptr if no threads are waiting
+ */
+ Thread* ResumeNextThread();
+
+ /// Releases all threads waiting on this object
+ void ReleaseAllWaitingThreads();
+
+private:
+ std::vector<Thread*> waiting_threads; ///< Threads waiting for this object to become available
+};
+
/**
* This class allows the creation of Handles, which are references to objects that can be tested
* for validity and looked up. Here they are used to pass references to kernel objects to/from the