summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/thread.cpp11
-rw-r--r--src/core/hle/kernel/thread.h19
2 files changed, 17 insertions, 13 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 */
74static bool CheckWait_WaitObject(const Thread* thread, WaitObject* wait_object) { 74static 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
259void WaitCurrentThread_ArbitrateAddress(VAddr wait_address) { 260void 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
307void Thread::ResumeFromWait() { 309void 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;
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h
index e2f0cc831..6cd8c20e2 100644
--- a/src/core/hle/kernel/thread.h
+++ b/src/core/hle/kernel/thread.h
@@ -31,13 +31,14 @@ enum ThreadProcessorId : s32 {
31}; 31};
32 32
33enum ThreadStatus { 33enum ThreadStatus {
34 THREADSTATUS_RUNNING, ///< Currently running 34 THREADSTATUS_RUNNING, ///< Currently running
35 THREADSTATUS_READY, ///< Ready to run 35 THREADSTATUS_READY, ///< Ready to run
36 THREADSTATUS_WAIT_ARB, ///< Waiting on an address arbiter 36 THREADSTATUS_WAIT_ARB, ///< Waiting on an address arbiter
37 THREADSTATUS_WAIT_SLEEP, ///< Waiting due to a SleepThread SVC 37 THREADSTATUS_WAIT_SLEEP, ///< Waiting due to a SleepThread SVC
38 THREADSTATUS_WAIT_SYNCH, ///< Waiting due to a WaitSynchronization SVC 38 THREADSTATUS_WAIT_SYNCH_ANY, ///< Waiting due to WaitSynch1 or WaitSynchN with wait_all = false
39 THREADSTATUS_DORMANT, ///< Created but not yet made ready 39 THREADSTATUS_WAIT_SYNCH_ALL, ///< Waiting due to WaitSynchronizationN with wait_all = true
40 THREADSTATUS_DEAD ///< Run to completion, or forcefully terminated 40 THREADSTATUS_DORMANT, ///< Created but not yet made ready
41 THREADSTATUS_DEAD ///< Run to completion, or forcefully terminated
41}; 42};
42 43
43namespace Kernel { 44namespace Kernel {
@@ -158,10 +159,10 @@ public:
158 /** 159 /**
159 * Returns whether this thread is waiting for all the objects in 160 * Returns whether this thread is waiting for all the objects in
160 * its wait list to become ready, as a result of a WaitSynchronizationN call 161 * its wait list to become ready, as a result of a WaitSynchronizationN call
161 * with wait_all = true, or a ReplyAndReceive call. 162 * with wait_all = true.
162 */ 163 */
163 bool IsSleepingOnWaitAll() const { 164 bool IsSleepingOnWaitAll() const {
164 return !wait_objects.empty(); 165 return status == THREADSTATUS_WAIT_SYNCH_ALL;
165 } 166 }
166 167
167 ARM_Interface::ThreadContext context; 168 ARM_Interface::ThreadContext context;