WaitSynchronizationN: Implement return values

This commit is contained in:
bunnei
2015-01-17 02:03:44 -05:00
parent e4a5d8ad4f
commit 7faf2d8e06
10 changed files with 193 additions and 87 deletions

View File

@ -32,11 +32,11 @@ public:
return available_count > 0;
}
ResultVal<bool> WaitSynchronization() override {
ResultVal<bool> WaitSynchronization(unsigned index) override {
bool wait = !IsAvailable();
if (wait) {
Kernel::WaitCurrentThread(WAITTYPE_SEMA, this);
Kernel::WaitCurrentThread_WaitSynchronization(WAITTYPE_SEMA, this, index);
AddWaitingThread(GetCurrentThread());
} else {
--available_count;
@ -82,7 +82,7 @@ ResultCode ReleaseSemaphore(s32* count, Handle handle, s32 release_count) {
// Notify some of the threads that the semaphore has been released
// stop once the semaphore is full again or there are no more waiting threads
while (semaphore->IsAvailable() && semaphore->ResumeNextThread() != nullptr) {
while (semaphore->IsAvailable() && semaphore->ReleaseNextThread() != nullptr) {
--semaphore->available_count;
}