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

@ -273,9 +273,8 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeSemaphore::GetChildren() cons
std::vector<std::unique_ptr<WaitTreeItem>> list(WaitTreeWaitObject::GetChildren());
const auto& semaphore = static_cast<const Kernel::Semaphore&>(object);
list.push_back(
std::make_unique<WaitTreeText>(tr("available count = %1").arg(semaphore.available_count)));
list.push_back(std::make_unique<WaitTreeText>(tr("max count = %1").arg(semaphore.max_count)));
list.push_back(std::make_unique<WaitTreeText>(
tr("available count = %1").arg(semaphore.GetAvailableCount())));
return list;
}