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:
parent
aa01c57ae9
commit
6643673f28
8 changed files with 75 additions and 78 deletions
|
@ -28,11 +28,11 @@ public:
|
|||
bool signaled; ///< Whether the event has already been signaled
|
||||
std::string name; ///< Name of event (optional)
|
||||
|
||||
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_EVENT, this, index);
|
||||
Kernel::WaitCurrentThread_WaitSynchronization(WAITTYPE_EVENT, this);
|
||||
}
|
||||
return MakeResult<bool>(wait);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue