mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-09 23:55:40 +12:00
[Kernel] Handle timeout errors properly
This commit is contained in:
parent
5e0c4b76ac
commit
74b06da6b2
2 changed files with 8 additions and 2 deletions
|
@ -45,10 +45,13 @@ bool Kernel::signalEvent(Handle handle) {
|
||||||
switch (t.status) {
|
switch (t.status) {
|
||||||
case ThreadStatus::WaitSync1:
|
case ThreadStatus::WaitSync1:
|
||||||
t.status = ThreadStatus::Ready;
|
t.status = ThreadStatus::Ready;
|
||||||
|
t.gprs[0] = SVCResult::Success; // The thread did not timeout, so write success to r0
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ThreadStatus::WaitSyncAny:
|
case ThreadStatus::WaitSyncAny:
|
||||||
t.status = ThreadStatus::Ready;
|
t.status = ThreadStatus::Ready;
|
||||||
|
t.gprs[0] = SVCResult::Success; // The thread did not timeout, so write success to r0
|
||||||
|
|
||||||
// Get the index of the event in the object's waitlist, write it to r1
|
// Get the index of the event in the object's waitlist, write it to r1
|
||||||
for (size_t i = 0; i < t.waitList.size(); i++) {
|
for (size_t i = 0; i < t.waitList.size(); i++) {
|
||||||
if (t.waitList[i] == handle) {
|
if (t.waitList[i] == handle) {
|
||||||
|
@ -151,7 +154,7 @@ void Kernel::waitSynchronization1() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
regs[0] = SVCResult::Success;
|
regs[0] = SVCResult::Timeout; // This will be overwritten with success if we don't timeout
|
||||||
|
|
||||||
auto& t = threads[currentThreadIndex];
|
auto& t = threads[currentThreadIndex];
|
||||||
t.waitList.resize(1);
|
t.waitList.resize(1);
|
||||||
|
@ -236,7 +239,7 @@ void Kernel::waitSynchronizationN() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
regs[0] = SVCResult::Success; // If the thread times out, this should be adjusted to SVCResult::Timeout
|
regs[0] = SVCResult::Timeout; // This will be overwritten with success if we don't timeout
|
||||||
// If the thread wakes up without timeout, this will be adjusted to the index of the handle that woke us up
|
// If the thread wakes up without timeout, this will be adjusted to the index of the handle that woke us up
|
||||||
regs[1] = 0xFFFFFFFF;
|
regs[1] = 0xFFFFFFFF;
|
||||||
t.waitList.resize(handleCount);
|
t.waitList.resize(handleCount);
|
||||||
|
|
|
@ -262,10 +262,13 @@ int Kernel::wakeupOneThread(u64 waitlist, Handle handle) {
|
||||||
switch (t.status) {
|
switch (t.status) {
|
||||||
case ThreadStatus::WaitSync1:
|
case ThreadStatus::WaitSync1:
|
||||||
t.status = ThreadStatus::Ready;
|
t.status = ThreadStatus::Ready;
|
||||||
|
t.gprs[0] = SVCResult::Success; // The thread did not timeout, so write success to r0
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ThreadStatus::WaitSyncAny:
|
case ThreadStatus::WaitSyncAny:
|
||||||
t.status = ThreadStatus::Ready;
|
t.status = ThreadStatus::Ready;
|
||||||
|
t.gprs[0] = SVCResult::Success; // The thread did not timeout, so write success to r0
|
||||||
|
|
||||||
// Get the index of the event in the object's waitlist, write it to r1
|
// Get the index of the event in the object's waitlist, write it to r1
|
||||||
for (size_t i = 0; i < t.waitList.size(); i++) {
|
for (size_t i = 0; i < t.waitList.size(); i++) {
|
||||||
if (t.waitList[i] == handle) {
|
if (t.waitList[i] == handle) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue