Add arbiter sleeping with timeout

Update threads.cpp
This commit is contained in:
wheremyfoodat 2025-02-11 19:02:14 +02:00
parent 54cdcacd5a
commit 456585a9e7
4 changed files with 51 additions and 13 deletions

View file

@ -95,6 +95,8 @@ public:
void signalArbiter(u32 waitingAddress, s32 threadCount);
void sleepThread(s64 ns);
void sleepThreadOnArbiter(u32 waitingAddress);
void sleepThreadOnArbiterWithTimeout(u32 waitingAddress, s64 timeoutNs);
void switchThread(int newThreadIndex);
void sortThreads();
std::optional<int> getNextThread();

View file

@ -98,16 +98,17 @@ struct Session {
};
enum class ThreadStatus {
Running, // Currently running
Ready, // Ready to run
WaitArbiter, // Waiting on an address arbiter
WaitSleep, // Waiting due to a SleepThread SVC
WaitSync1, // Waiting for the single object in the wait list to be ready
WaitSyncAny, // Wait for one object of the many that might be in the wait list to be ready
WaitSyncAll, // Waiting for ALL sync objects in its wait list to be ready
WaitIPC, // Waiting for the reply from an IPC request
Dormant, // Created but not yet made ready
Dead // Run to completion, or forcefully terminated
Running, // Currently running
Ready, // Ready to run
WaitArbiter, // Waiting on an address arbiter
WaitArbiterTimeout, // Waiting on an address arbiter with timeout
WaitSleep, // Waiting due to a SleepThread SVC
WaitSync1, // Waiting for the single object in the wait list to be ready
WaitSyncAny, // Wait for one object of the many that might be in the wait list to be ready
WaitSyncAll, // Waiting for ALL sync objects in its wait list to be ready
WaitIPC, // Waiting for the reply from an IPC request
Dormant, // Created but not yet made ready
Dead // Run to completion, or forcefully terminated
};
struct Thread {