summaryrefslogtreecommitdiffstats
path: root/src/core/hle/svc.cpp
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2017-01-04 16:53:01 +0100
committerSubv <subv2112@gmail.com>2017-01-05 15:40:14 +0100
commitfd95b6ee2606da4cd47c5f2916ad3b4f86c0e0f4 (patch)
tree5a3d1487e24f089b68358ddd8984c12e65623055 /src/core/hle/svc.cpp
parentKernel: Use different thread statuses when a thread calls WaitSynchronization1 and WaitSynchronizationN with wait_all = true. (diff)
downloadyuzu-fd95b6ee2606da4cd47c5f2916ad3b4f86c0e0f4.tar
yuzu-fd95b6ee2606da4cd47c5f2916ad3b4f86c0e0f4.tar.gz
yuzu-fd95b6ee2606da4cd47c5f2916ad3b4f86c0e0f4.tar.bz2
yuzu-fd95b6ee2606da4cd47c5f2916ad3b4f86c0e0f4.tar.lz
yuzu-fd95b6ee2606da4cd47c5f2916ad3b4f86c0e0f4.tar.xz
yuzu-fd95b6ee2606da4cd47c5f2916ad3b4f86c0e0f4.tar.zst
yuzu-fd95b6ee2606da4cd47c5f2916ad3b4f86c0e0f4.zip
Diffstat (limited to 'src/core/hle/svc.cpp')
-rw-r--r--src/core/hle/svc.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index 1e1ca5180..855f3af82 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -277,6 +277,7 @@ static ResultCode WaitSynchronization1(Kernel::Handle handle, s64 nano_seconds)
if (nano_seconds == 0)
return ERR_SYNC_TIMEOUT;
+ thread->wait_objects = {object};
object->AddWaitingThread(thread);
thread->status = THREADSTATUS_WAIT_SYNCH_ANY;
@@ -325,11 +326,6 @@ static ResultCode WaitSynchronizationN(s32* out, Kernel::Handle* handles, s32 ha
objects[i] = object;
}
- // Clear the mapping of wait object indices.
- // We don't want any lingering state in this map.
- // It will be repopulated later in the wait_all = false case.
- thread->wait_objects_index.clear();
-
if (wait_all) {
bool all_available =
std::all_of(objects.begin(), objects.end(),
@@ -358,7 +354,6 @@ static ResultCode WaitSynchronizationN(s32* out, Kernel::Handle* handles, s32 ha
object->AddWaitingThread(thread);
}
- // Set the thread's waitlist to the list of objects passed to WaitSynchronizationN
thread->wait_objects = std::move(objects);
// Create an event to wake the thread up after the specified nanosecond delay has passed
@@ -395,17 +390,14 @@ static ResultCode WaitSynchronizationN(s32* out, Kernel::Handle* handles, s32 ha
// Put the thread to sleep
thread->status = THREADSTATUS_WAIT_SYNCH_ANY;
- // Clear the thread's waitlist, we won't use it for wait_all = false
- thread->wait_objects.clear();
-
// Add the thread to each of the objects' waiting threads.
for (size_t i = 0; i < objects.size(); ++i) {
Kernel::WaitObject* object = objects[i].get();
- // Set the index of this object in the mapping of Objects -> index for this thread.
- thread->wait_objects_index[object->GetObjectId()] = static_cast<int>(i);
object->AddWaitingThread(thread);
}
+ thread->wait_objects = std::move(objects);
+
// Note: If no handles and no timeout were given, then the thread will deadlock, this is
// consistent with hardware behavior.