mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-22 19:45:46 +00:00
WaitSynchronizationN: Implement return values
This commit is contained in:
parent
e4a5d8ad4f
commit
7faf2d8e06
10 changed files with 193 additions and 87 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue