summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/kernel.h
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2017-05-29 15:45:30 -0700
committerGravatar Yuri Kunde Schlesner2017-05-29 16:16:46 -0700
commit64ecf81a3cf6d6e0a4e4e915e1da2f0bcf2f1cb4 (patch)
treef34182d882d614273dd709f0029039743bc58c21 /src/core/hle/kernel/kernel.h
parentKernel: Removed HandleTable::GetWaitObject (diff)
downloadyuzu-64ecf81a3cf6d6e0a4e4e915e1da2f0bcf2f1cb4.tar.gz
yuzu-64ecf81a3cf6d6e0a4e4e915e1da2f0bcf2f1cb4.tar.xz
yuzu-64ecf81a3cf6d6e0a4e4e915e1da2f0bcf2f1cb4.zip
Kernel: Move WaitObject to a separate file
Now that HandleTable doesn't directly depend on WaitObject anymore, this can be separated from the main kernel.h header.
Diffstat (limited to 'src/core/hle/kernel/kernel.h')
-rw-r--r--src/core/hle/kernel/kernel.h53
1 files changed, 0 insertions, 53 deletions
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index 4344264dc..5335a961d 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -17,8 +17,6 @@ namespace Kernel {
17 17
18using Handle = u32; 18using Handle = u32;
19 19
20class Thread;
21
22enum KernelHandle : Handle { 20enum KernelHandle : Handle {
23 CurrentThread = 0xFFFF8000, 21 CurrentThread = 0xFFFF8000,
24 CurrentProcess = 0xFFFF8001, 22 CurrentProcess = 0xFFFF8001,
@@ -133,57 +131,6 @@ inline SharedPtr<T> DynamicObjectCast(SharedPtr<Object> object) {
133 return nullptr; 131 return nullptr;
134} 132}
135 133
136/// Class that represents a Kernel object that a thread can be waiting on
137class WaitObject : public Object {
138public:
139 /**
140 * Check if the specified thread should wait until the object is available
141 * @param thread The thread about which we're deciding.
142 * @return True if the current thread should wait due to this object being unavailable
143 */
144 virtual bool ShouldWait(Thread* thread) const = 0;
145
146 /// Acquire/lock the object for the specified thread if it is available
147 virtual void Acquire(Thread* thread) = 0;
148
149 /**
150 * Add a thread to wait on this object
151 * @param thread Pointer to thread to add
152 */
153 virtual void AddWaitingThread(SharedPtr<Thread> thread);
154
155 /**
156 * Removes a thread from waiting on this object (e.g. if it was resumed already)
157 * @param thread Pointer to thread to remove
158 */
159 virtual void RemoveWaitingThread(Thread* thread);
160
161 /**
162 * Wake up all threads waiting on this object that can be awoken, in priority order,
163 * and set the synchronization result and output of the thread.
164 */
165 virtual void WakeupAllWaitingThreads();
166
167 /// Obtains the highest priority thread that is ready to run from this object's waiting list.
168 SharedPtr<Thread> GetHighestPriorityReadyThread();
169
170 /// Get a const reference to the waiting threads list for debug use
171 const std::vector<SharedPtr<Thread>>& GetWaitingThreads() const;
172
173private:
174 /// Threads waiting for this object to become available
175 std::vector<SharedPtr<Thread>> waiting_threads;
176};
177
178// Specialization of DynamicObjectCast for WaitObjects
179template <>
180inline SharedPtr<WaitObject> DynamicObjectCast<WaitObject>(SharedPtr<Object> object) {
181 if (object != nullptr && object->IsWaitable()) {
182 return boost::static_pointer_cast<WaitObject>(std::move(object));
183 }
184 return nullptr;
185}
186
187/** 134/**
188 * This class allows the creation of Handles, which are references to objects that can be tested 135 * This class allows the creation of Handles, which are references to objects that can be tested
189 * for validity and looked up. Here they are used to pass references to kernel objects to/from the 136 * for validity and looked up. Here they are used to pass references to kernel objects to/from the