diff options
| author | 2017-01-04 10:44:38 -0500 | |
|---|---|---|
| committer | 2017-01-04 15:58:50 -0500 | |
| commit | cef5f45de2fd64f0728d4504d0ad7434cb8ac519 (patch) | |
| tree | a8297434a72bc21d1cec17e3414766ece0ec0054 /src/core/hle/kernel/thread.cpp | |
| parent | Kernel/Mutex: Propagate thread priority changes to other threads inheriting t... (diff) | |
| download | yuzu-cef5f45de2fd64f0728d4504d0ad7434cb8ac519.tar.gz yuzu-cef5f45de2fd64f0728d4504d0ad7434cb8ac519.tar.xz yuzu-cef5f45de2fd64f0728d4504d0ad7434cb8ac519.zip | |
Kernel: Use different thread statuses when a thread calls WaitSynchronization1 and WaitSynchronizationN with wait_all = true.
This commit removes the overly general THREADSTATUS_WAIT_SYNCH and replaces it with two more granular statuses:
THREADSTATUS_WAIT_SYNCH_ANY when a thread waits on objects via WaitSynchronization1 or WaitSynchronizationN with wait_all = false.
THREADSTATUS_WAIT_SYNCH_ALL when a thread waits on objects via WaitSynchronizationN with wait_all = true.
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 3a5a67450..aa99d18c7 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -72,7 +72,8 @@ Thread* GetCurrentThread() { | |||
| 72 | * @return True if the thread is waiting, false otherwise | 72 | * @return True if the thread is waiting, false otherwise |
| 73 | */ | 73 | */ |
| 74 | static bool CheckWait_WaitObject(const Thread* thread, WaitObject* wait_object) { | 74 | static bool CheckWait_WaitObject(const Thread* thread, WaitObject* wait_object) { |
| 75 | if (thread->status != THREADSTATUS_WAIT_SYNCH) | 75 | if (thread->status != THREADSTATUS_WAIT_SYNCH_ALL && |
| 76 | thread->status != THREADSTATUS_WAIT_SYNCH_ANY) | ||
| 76 | return false; | 77 | return false; |
| 77 | 78 | ||
| 78 | auto itr = std::find(thread->wait_objects.begin(), thread->wait_objects.end(), wait_object); | 79 | auto itr = std::find(thread->wait_objects.begin(), thread->wait_objects.end(), wait_object); |
| @@ -253,7 +254,7 @@ void WaitCurrentThread_WaitSynchronization(std::vector<SharedPtr<WaitObject>> wa | |||
| 253 | Thread* thread = GetCurrentThread(); | 254 | Thread* thread = GetCurrentThread(); |
| 254 | thread->wait_set_output = wait_set_output; | 255 | thread->wait_set_output = wait_set_output; |
| 255 | thread->wait_objects = std::move(wait_objects); | 256 | thread->wait_objects = std::move(wait_objects); |
| 256 | thread->status = THREADSTATUS_WAIT_SYNCH; | 257 | thread->status = THREADSTATUS_WAIT_SYNCH_ANY; |
| 257 | } | 258 | } |
| 258 | 259 | ||
| 259 | void WaitCurrentThread_ArbitrateAddress(VAddr wait_address) { | 260 | void WaitCurrentThread_ArbitrateAddress(VAddr wait_address) { |
| @@ -281,7 +282,8 @@ static void ThreadWakeupCallback(u64 thread_handle, int cycles_late) { | |||
| 281 | return; | 282 | return; |
| 282 | } | 283 | } |
| 283 | 284 | ||
| 284 | if (thread->status == THREADSTATUS_WAIT_SYNCH || thread->status == THREADSTATUS_WAIT_ARB) { | 285 | if (thread->status == THREADSTATUS_WAIT_SYNCH_ANY || |
| 286 | thread->status == THREADSTATUS_WAIT_SYNCH_ALL || thread->status == THREADSTATUS_WAIT_ARB) { | ||
| 285 | thread->wait_set_output = false; | 287 | thread->wait_set_output = false; |
| 286 | // Remove the thread from each of its waiting objects' waitlists | 288 | // Remove the thread from each of its waiting objects' waitlists |
| 287 | for (auto& object : thread->wait_objects) | 289 | for (auto& object : thread->wait_objects) |
| @@ -306,7 +308,8 @@ void Thread::WakeAfterDelay(s64 nanoseconds) { | |||
| 306 | 308 | ||
| 307 | void Thread::ResumeFromWait() { | 309 | void Thread::ResumeFromWait() { |
| 308 | switch (status) { | 310 | switch (status) { |
| 309 | case THREADSTATUS_WAIT_SYNCH: | 311 | case THREADSTATUS_WAIT_SYNCH_ALL: |
| 312 | case THREADSTATUS_WAIT_SYNCH_ANY: | ||
| 310 | case THREADSTATUS_WAIT_ARB: | 313 | case THREADSTATUS_WAIT_ARB: |
| 311 | case THREADSTATUS_WAIT_SLEEP: | 314 | case THREADSTATUS_WAIT_SLEEP: |
| 312 | break; | 315 | break; |