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.
This commit is contained in:
parent
e6a7723f2f
commit
7abf185390
5 changed files with 51 additions and 31 deletions
|
@ -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<Thread> holding_thread; ///< Thread that has acquired the mutex
|
||||
|
||||
bool ShouldWait(Thread* thread) const override;
|
||||
void Acquire(Thread* thread) override;
|
||||
|
||||
void AddWaitingThread(SharedPtr<Thread> thread) override;
|
||||
|
||||
/**
|
||||
* Acquires the specified mutex for the specified thread
|
||||
* @param thread Thread that will acquire the mutex
|
||||
*/
|
||||
void Acquire(SharedPtr<Thread> thread);
|
||||
void Release();
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue