diff options
| author | 2017-05-29 15:45:30 -0700 | |
|---|---|---|
| committer | 2017-05-29 16:16:46 -0700 | |
| commit | 64ecf81a3cf6d6e0a4e4e915e1da2f0bcf2f1cb4 (patch) | |
| tree | f34182d882d614273dd709f0029039743bc58c21 /src/core/hle/kernel/kernel.h | |
| parent | Kernel: Removed HandleTable::GetWaitObject (diff) | |
| download | yuzu-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.h | 53 |
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 | ||
| 18 | using Handle = u32; | 18 | using Handle = u32; |
| 19 | 19 | ||
| 20 | class Thread; | ||
| 21 | |||
| 22 | enum KernelHandle : Handle { | 20 | enum 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 | ||
| 137 | class WaitObject : public Object { | ||
| 138 | public: | ||
| 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 | |||
| 173 | private: | ||
| 174 | /// Threads waiting for this object to become available | ||
| 175 | std::vector<SharedPtr<Thread>> waiting_threads; | ||
| 176 | }; | ||
| 177 | |||
| 178 | // Specialization of DynamicObjectCast for WaitObjects | ||
| 179 | template <> | ||
| 180 | inline 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 |