From 7abf1853907fe086753df0031262b668a2da88b0 Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 1 Jan 2017 16:59:30 -0500 Subject: Kernel/Mutex: Implemented priority inheritance. The implementation is based on reverse engineering of the 3DS's kernel. A mutex holder's priority will be temporarily boosted to the best priority among any threads that want to acquire any of its held mutexes. When the holder releases the mutex, it's priority will be boosted to the best priority among the threads that want to acquire any of its remaining held mutexes. --- src/core/hle/kernel/mutex.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/core/hle/kernel/mutex.h') diff --git a/src/core/hle/kernel/mutex.h b/src/core/hle/kernel/mutex.h index 98b3d40b5..3e6adeb17 100644 --- a/src/core/hle/kernel/mutex.h +++ b/src/core/hle/kernel/mutex.h @@ -35,18 +35,15 @@ public: } int lock_count; ///< Number of times the mutex has been acquired + u32 priority; ///< The priority of the mutex, used for priority inheritance. std::string name; ///< Name of mutex (optional) SharedPtr holding_thread; ///< Thread that has acquired the mutex bool ShouldWait(Thread* thread) const override; void Acquire(Thread* thread) override; + void AddWaitingThread(SharedPtr thread) override; - /** - * Acquires the specified mutex for the specified thread - * @param thread Thread that will acquire the mutex - */ - void Acquire(SharedPtr thread); void Release(); private: -- cgit v1.2.3