mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-18 03:31:31 +12:00
[Mutex[ Request reschedule when acquiring mutex
This commit is contained in:
parent
fbc10bf3da
commit
7047bf6ec8
1 changed files with 7 additions and 1 deletions
|
@ -220,7 +220,13 @@ void Kernel::acquireSyncObject(KernelObject* object, const Thread& thread) {
|
||||||
|
|
||||||
case KernelObjectType::Mutex: {
|
case KernelObjectType::Mutex: {
|
||||||
Mutex* moo = object->getData<Mutex>();
|
Mutex* moo = object->getData<Mutex>();
|
||||||
moo->locked = true; // Set locked to true, whether it's false or not because who cares
|
|
||||||
|
// Only reschedule if we're acquiring the mutex for the first time
|
||||||
|
if (!moo->locked) {
|
||||||
|
moo->locked = true;
|
||||||
|
requireReschedule();
|
||||||
|
}
|
||||||
|
|
||||||
// Increment lock count by 1. If a thread acquires a mootex multiple times, it needs to release it until count == 0
|
// Increment lock count by 1. If a thread acquires a mootex multiple times, it needs to release it until count == 0
|
||||||
// For the mootex to be free.
|
// For the mootex to be free.
|
||||||
moo->lockCount++;
|
moo->lockCount++;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue