Kernel: Actually wake up the requested number of threads in Semaphore::Release.

Also properly keep track of data in guest memory, this fixes managing the semaphore from userland.

It was found that Semaphores are actually Condition Variables, with Release(1) and Release(-1) being equivalent to notify_one and notify_all. We should change the name of the class to reflect this.
This commit is contained in:
Subv 2018-01-08 14:14:30 -05:00 committed by bunnei
parent 1bbe9309da
commit db3a525166
4 changed files with 18 additions and 21 deletions

View file

@ -501,7 +501,7 @@ static ResultCode WaitProcessWideKeyAtomic(VAddr mutex_addr, VAddr semaphore_add
semaphore->name = Common::StringFromFormat("semaphore-%llx", semaphore_addr);
}
ASSERT(semaphore->available_count == 0);
ASSERT(semaphore->GetAvailableCount() == 0);
ASSERT(semaphore->mutex_addr == mutex_addr);
auto wakeup_callback = [mutex, nano_seconds](ThreadWakeupReason reason,