mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-09 16:09:57 +00:00
WaitSynchronizationN: Handle case where handle_count=0.
This commit is contained in:
parent
7faf2d8e06
commit
064be2b86f
1 changed files with 27 additions and 17 deletions
|
@ -148,6 +148,8 @@ static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count,
|
||||||
bool wait_all_succeeded = false;
|
bool wait_all_succeeded = false;
|
||||||
int handle_index = 0;
|
int handle_index = 0;
|
||||||
|
|
||||||
|
// If handles were passed in, iterate through them and wait/acquire the objects as needed
|
||||||
|
if (handle_count > 0) {
|
||||||
while (handle_index < handle_count) {
|
while (handle_index < handle_count) {
|
||||||
SharedPtr<Kernel::Object> object = Kernel::g_handle_table.GetGeneric(handles[handle_index]);
|
SharedPtr<Kernel::Object> object = Kernel::g_handle_table.GetGeneric(handles[handle_index]);
|
||||||
if (object == nullptr)
|
if (object == nullptr)
|
||||||
|
@ -170,6 +172,14 @@ static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count,
|
||||||
|
|
||||||
handle_index++;
|
handle_index++;
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
// If no handles were passed in, put the thread to sleep only when wait_all=false
|
||||||
|
// NOTE: This is supposed to deadlock if no timeout was specified
|
||||||
|
if (!wait_all) {
|
||||||
|
wait_thread = true;
|
||||||
|
Kernel::WaitCurrentThread(WAITTYPE_SLEEP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Change the thread state to waiting if blocking on all handles...
|
// Change the thread state to waiting if blocking on all handles...
|
||||||
if (wait_thread || wait_all_succeeded) {
|
if (wait_thread || wait_all_succeeded) {
|
||||||
|
|
Loading…
Reference in a new issue