mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-21 21:05:50 +12:00
[Kernel] Implement ArbitrationType::DecrementAndWaitIfLess
This commit is contained in:
parent
81b0f3dde0
commit
6c3acda34e
3 changed files with 16 additions and 6 deletions
|
@ -58,7 +58,7 @@ void Kernel::arbitrateAddress() {
|
|||
regs[0] = SVCResult::Success;
|
||||
|
||||
switch (static_cast<ArbitrationType>(type)) {
|
||||
// Puts this thread to sleep if word < value until another thread signals the address with the type SIGNAL
|
||||
// Puts this thread to sleep if word < value until another thread arbitrates the address using SIGNAL
|
||||
case ArbitrationType::WaitIfLess: {
|
||||
s32 word = static_cast<s32>(mem.read32(address)); // Yes this is meant to be signed
|
||||
if (word < value) {
|
||||
|
@ -67,6 +67,17 @@ void Kernel::arbitrateAddress() {
|
|||
break;
|
||||
}
|
||||
|
||||
// Puts this thread to sleep if word < value until another thread arbitrates the address using SIGNAL
|
||||
// If the thread is put to sleep, the arbiter address is decremented
|
||||
case ArbitrationType::DecrementAndWaitIfLess: {
|
||||
s32 word = static_cast<s32>(mem.read32(address)); // Yes this is meant to be signed
|
||||
if (word < value) {
|
||||
mem.write32(address, word - 1);
|
||||
sleepThreadOnArbiter(address);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ArbitrationType::Signal:
|
||||
signalArbiter(address, value);
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue