From 8634b8cb83755b6c6554faa11c0e488d2ad21f90 Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 3 Dec 2016 22:38:14 -0500 Subject: Threading: Reworked the way our scheduler works. Threads will now be awakened when the objects they're waiting on are signaled, instead of repeating the WaitSynchronization call every now and then. The scheduler is now called once after every SVC call, and once after a thread is awakened from sleep by its timeout callback. This new implementation is based off reverse-engineering of the real kernel. See https://gist.github.com/Subv/02f29bd9f1e5deb7aceea1e8f019c8f4 for a more detailed description of how the real kernel handles rescheduling. --- src/citra_qt/debugger/wait_tree.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/citra_qt') diff --git a/src/citra_qt/debugger/wait_tree.cpp b/src/citra_qt/debugger/wait_tree.cpp index be5a51e52..8fc3e37e0 100644 --- a/src/citra_qt/debugger/wait_tree.cpp +++ b/src/citra_qt/debugger/wait_tree.cpp @@ -230,7 +230,7 @@ std::vector> WaitTreeThread::GetChildren() const { list.push_back(std::make_unique(thread.held_mutexes)); } if (thread.status == THREADSTATUS_WAIT_SYNCH) { - list.push_back(std::make_unique(thread.wait_objects, thread.wait_all)); + list.push_back(std::make_unique(thread.wait_objects, !thread.wait_objects.empty())); } return list; -- cgit v1.2.3 From bdad00c73f46106ba78995bdde1b50349e940b09 Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 4 Dec 2016 09:58:36 -0500 Subject: Threading: Added some utility functions and const correctness. --- src/citra_qt/debugger/wait_tree.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/citra_qt') diff --git a/src/citra_qt/debugger/wait_tree.cpp b/src/citra_qt/debugger/wait_tree.cpp index 8fc3e37e0..829ac7dd6 100644 --- a/src/citra_qt/debugger/wait_tree.cpp +++ b/src/citra_qt/debugger/wait_tree.cpp @@ -230,7 +230,7 @@ std::vector> WaitTreeThread::GetChildren() const { list.push_back(std::make_unique(thread.held_mutexes)); } if (thread.status == THREADSTATUS_WAIT_SYNCH) { - list.push_back(std::make_unique(thread.wait_objects, !thread.wait_objects.empty())); + list.push_back(std::make_unique(thread.wait_objects, thread.IsWaitingAll())); } return list; -- cgit v1.2.3 From 17b29d8865ea4d96c18f7e1671bd6d0f01eab95f Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 8 Dec 2016 10:34:53 -0500 Subject: WaitSynch: Removed unused variables and reduced SharedPtr copies. Define a variable with the value of the sync timeout error code. Use a boost::flat_map instead of an unordered_map to hold the equivalence of objects and wait indices in a WaitSynchN call. --- src/citra_qt/debugger/wait_tree.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/citra_qt') diff --git a/src/citra_qt/debugger/wait_tree.cpp b/src/citra_qt/debugger/wait_tree.cpp index 829ac7dd6..8ff094209 100644 --- a/src/citra_qt/debugger/wait_tree.cpp +++ b/src/citra_qt/debugger/wait_tree.cpp @@ -230,7 +230,7 @@ std::vector> WaitTreeThread::GetChildren() const { list.push_back(std::make_unique(thread.held_mutexes)); } if (thread.status == THREADSTATUS_WAIT_SYNCH) { - list.push_back(std::make_unique(thread.wait_objects, thread.IsWaitingAll())); + list.push_back(std::make_unique(thread.wait_objects, thread.IsSleepingOnWaitAll())); } return list; -- cgit v1.2.3 From 5b1edc6ae70972d4a11eee1f1ff8fdff2122b5a2 Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 14 Dec 2016 12:13:02 -0500 Subject: Fixed the codestyle to match our clang-format rules. --- src/citra_qt/debugger/wait_tree.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/citra_qt') diff --git a/src/citra_qt/debugger/wait_tree.cpp b/src/citra_qt/debugger/wait_tree.cpp index 8ff094209..b2e7f4a97 100644 --- a/src/citra_qt/debugger/wait_tree.cpp +++ b/src/citra_qt/debugger/wait_tree.cpp @@ -230,7 +230,8 @@ std::vector> WaitTreeThread::GetChildren() const { list.push_back(std::make_unique(thread.held_mutexes)); } if (thread.status == THREADSTATUS_WAIT_SYNCH) { - list.push_back(std::make_unique(thread.wait_objects, thread.IsSleepingOnWaitAll())); + list.push_back(std::make_unique(thread.wait_objects, + thread.IsSleepingOnWaitAll())); } return list; -- cgit v1.2.3