[Kernel] Make WaitSyncN better

This commit is contained in:
wheremyfoodat 2023-04-21 01:08:13 +03:00
parent f575d4db82
commit 33158c7908
6 changed files with 128 additions and 56 deletions

View file

@ -62,6 +62,8 @@ public:
Handle makeMutex(bool locked = false); // Needs to be public to be accessible to the APT/DSP services
Handle makeSemaphore(u32 initialCount, u32 maximumCount); // Needs to be public to be accessible to the service manager port
// Signals an event, returns true on success or false if the event does not exist
bool signalEvent(Handle e);
private:
void signalArbiter(u32 waitingAddress, s32 threadCount);
void sleepThread(s64 ns);
@ -103,9 +105,7 @@ private:
// SVC implementations
void arbitrateAddress();
void clearEvent();
void createAddressArbiter();
void createEvent();
void createMemoryBlock();
void createThread();
void controlMemory();
@ -123,10 +123,12 @@ private:
void getThreadPriority();
void sendSyncRequest();
void setThreadPriority();
void signalEvent();
void svcClearEvent();
void svcCloseHandle();
void svcCreateEvent();
void svcCreateMutex();
void svcReleaseMutex();
void svcSignalEvent();
void svcSleepThread();
void connectToPort();
void outputDebugString();

View file

@ -105,7 +105,8 @@ enum class ThreadStatus {
Ready, // Ready to run
WaitArbiter, // Waiting on an address arbiter
WaitSleep, // Waiting due to a SleepThread SVC
WaitSync1, // Waiting for AT LEAST one sync object in its wait list to be ready
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