From 64ecf81a3cf6d6e0a4e4e915e1da2f0bcf2f1cb4 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Mon, 29 May 2017 15:45:30 -0700 Subject: 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. --- src/core/hle/kernel/kernel.h | 53 -------------------------------------------- 1 file changed, 53 deletions(-) (limited to 'src/core/hle/kernel/kernel.h') 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 { using Handle = u32; -class Thread; - enum KernelHandle : Handle { CurrentThread = 0xFFFF8000, CurrentProcess = 0xFFFF8001, @@ -133,57 +131,6 @@ inline SharedPtr DynamicObjectCast(SharedPtr object) { return nullptr; } -/// Class that represents a Kernel object that a thread can be waiting on -class WaitObject : public Object { -public: - /** - * Check if the specified thread should wait until the object is available - * @param thread The thread about which we're deciding. - * @return True if the current thread should wait due to this object being unavailable - */ - virtual bool ShouldWait(Thread* thread) const = 0; - - /// Acquire/lock the object for the specified thread if it is available - virtual void Acquire(Thread* thread) = 0; - - /** - * Add a thread to wait on this object - * @param thread Pointer to thread to add - */ - virtual void AddWaitingThread(SharedPtr thread); - - /** - * Removes a thread from waiting on this object (e.g. if it was resumed already) - * @param thread Pointer to thread to remove - */ - virtual void RemoveWaitingThread(Thread* thread); - - /** - * Wake up all threads waiting on this object that can be awoken, in priority order, - * and set the synchronization result and output of the thread. - */ - virtual void WakeupAllWaitingThreads(); - - /// Obtains the highest priority thread that is ready to run from this object's waiting list. - SharedPtr GetHighestPriorityReadyThread(); - - /// Get a const reference to the waiting threads list for debug use - const std::vector>& GetWaitingThreads() const; - -private: - /// Threads waiting for this object to become available - std::vector> waiting_threads; -}; - -// Specialization of DynamicObjectCast for WaitObjects -template <> -inline SharedPtr DynamicObjectCast(SharedPtr object) { - if (object != nullptr && object->IsWaitable()) { - return boost::static_pointer_cast(std::move(object)); - } - return nullptr; -} - /** * 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 -- cgit v1.2.3