diff options
| author | 2015-01-14 19:22:50 -0500 | |
|---|---|---|
| committer | 2015-01-21 18:41:00 -0500 | |
| commit | c22bac6398ff1705992fc44b2c29775c84cff662 (patch) | |
| tree | e20da7e6e1824c19b7ced73f43815397749ffae7 /src/core/hle/kernel/thread.cpp | |
| parent | Merge pull request #491 from archshift/hidspvr (diff) | |
| download | yuzu-c22bac6398ff1705992fc44b2c29775c84cff662.tar.gz yuzu-c22bac6398ff1705992fc44b2c29775c84cff662.tar.xz yuzu-c22bac6398ff1705992fc44b2c29775c84cff662.zip | |
Kernel: Added WaitObject and changed "waitable" objects inherit from it.
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index bc86a7c59..845672702 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -25,10 +25,7 @@ namespace Kernel { | |||
| 25 | ResultVal<bool> Thread::WaitSynchronization() { | 25 | ResultVal<bool> Thread::WaitSynchronization() { |
| 26 | const bool wait = status != THREADSTATUS_DORMANT; | 26 | const bool wait = status != THREADSTATUS_DORMANT; |
| 27 | if (wait) { | 27 | if (wait) { |
| 28 | Thread* thread = GetCurrentThread(); | 28 | AddWaitingThread(GetCurrentThread()); |
| 29 | if (std::find(waiting_threads.begin(), waiting_threads.end(), thread) == waiting_threads.end()) { | ||
| 30 | waiting_threads.push_back(thread); | ||
| 31 | } | ||
| 32 | WaitCurrentThread(WAITTYPE_THREADEND, this); | 29 | WaitCurrentThread(WAITTYPE_THREADEND, this); |
| 33 | } | 30 | } |
| 34 | 31 | ||
| @@ -110,11 +107,7 @@ void Thread::Stop(const char* reason) { | |||
| 110 | 107 | ||
| 111 | ChangeReadyState(this, false); | 108 | ChangeReadyState(this, false); |
| 112 | status = THREADSTATUS_DORMANT; | 109 | status = THREADSTATUS_DORMANT; |
| 113 | for (auto& waiting_thread : waiting_threads) { | 110 | ResumeAllWaitingThreads(); |
| 114 | if (CheckWaitType(waiting_thread.get(), WAITTYPE_THREADEND, this)) | ||
| 115 | waiting_thread->ResumeFromWait(); | ||
| 116 | } | ||
| 117 | waiting_threads.clear(); | ||
| 118 | 111 | ||
| 119 | // Stopped threads are never waiting. | 112 | // Stopped threads are never waiting. |
| 120 | wait_type = WAITTYPE_NONE; | 113 | wait_type = WAITTYPE_NONE; |