WaitSynchronizationN: Refactor to fix several bugs

- Separate wait checking from waiting the current thread
- Resume thread when wait_all=true only if all objects are available at once
- Set output to correct wait object index when there are duplicate handles
This commit is contained in:
bunnei 2015-01-18 01:27:46 -05:00
parent aa01c57ae9
commit 6643673f28
8 changed files with 75 additions and 78 deletions

View file

@ -29,11 +29,11 @@ public:
u64 initial_delay; ///< The delay until the timer fires for the first time
u64 interval_delay; ///< The delay until the timer fires after the first time
ResultVal<bool> Wait(unsigned index) override {
ResultVal<bool> Wait(bool wait_thread) override {
bool wait = !signaled;
if (wait) {
if (wait && wait_thread) {
AddWaitingThread(GetCurrentThread());
Kernel::WaitCurrentThread_WaitSynchronization(WAITTYPE_TIMER, this, index);
Kernel::WaitCurrentThread_WaitSynchronization(WAITTYPE_TIMER, this);
}
return MakeResult<bool>(wait);
}