summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/thread.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2018-03-18 22:25:09 -0400
committerGravatar GitHub2018-03-18 22:25:09 -0400
commit2dc3a56e9602e0bfba9bfc19f31f0433d1564ccc (patch)
tree6e49476a6c0c1a333090a01afa7a4fbfd11b8888 /src/core/hle/kernel/thread.cpp
parentMerge pull request #249 from Subv/macro_E1A (diff)
parentvi: Remove DequeueBuffer and wait until next available buffer. (diff)
downloadyuzu-2dc3a56e9602e0bfba9bfc19f31f0433d1564ccc.tar.gz
yuzu-2dc3a56e9602e0bfba9bfc19f31f0433d1564ccc.tar.xz
yuzu-2dc3a56e9602e0bfba9bfc19f31f0433d1564ccc.zip
Merge pull request #250 from bunnei/buffer-dequeue-wait
vi: TransactParcel DequeueBuffer should wait current thread
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
-rw-r--r--src/core/hle/kernel/thread.cpp21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index a39c53db5..145f50887 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -55,16 +55,6 @@ inline static u32 const NewThreadId() {
55Thread::Thread() {} 55Thread::Thread() {}
56Thread::~Thread() {} 56Thread::~Thread() {}
57 57
58/**
59 * Check if the specified thread is waiting on the specified address to be arbitrated
60 * @param thread The thread to test
61 * @param wait_address The address to test against
62 * @return True if the thread is waiting, false otherwise
63 */
64static bool CheckWait_AddressArbiter(const Thread* thread, VAddr wait_address) {
65 return thread->status == THREADSTATUS_WAIT_ARB && wait_address == thread->wait_address;
66}
67
68void Thread::Stop() { 58void Thread::Stop() {
69 // Cancel any outstanding wakeup events for this thread 59 // Cancel any outstanding wakeup events for this thread
70 CoreTiming::UnscheduleEvent(ThreadWakeupEventType, callback_handle); 60 CoreTiming::UnscheduleEvent(ThreadWakeupEventType, callback_handle);
@@ -102,12 +92,6 @@ void WaitCurrentThread_Sleep() {
102 thread->status = THREADSTATUS_WAIT_SLEEP; 92 thread->status = THREADSTATUS_WAIT_SLEEP;
103} 93}
104 94
105void WaitCurrentThread_ArbitrateAddress(VAddr wait_address) {
106 Thread* thread = GetCurrentThread();
107 thread->wait_address = wait_address;
108 thread->status = THREADSTATUS_WAIT_ARB;
109}
110
111void ExitCurrentThread() { 95void ExitCurrentThread() {
112 Thread* thread = GetCurrentThread(); 96 Thread* thread = GetCurrentThread();
113 thread->Stop(); 97 thread->Stop();
@@ -129,7 +113,8 @@ static void ThreadWakeupCallback(u64 thread_handle, int cycles_late) {
129 bool resume = true; 113 bool resume = true;
130 114
131 if (thread->status == THREADSTATUS_WAIT_SYNCH_ANY || 115 if (thread->status == THREADSTATUS_WAIT_SYNCH_ANY ||
132 thread->status == THREADSTATUS_WAIT_SYNCH_ALL || thread->status == THREADSTATUS_WAIT_ARB) { 116 thread->status == THREADSTATUS_WAIT_SYNCH_ALL ||
117 thread->status == THREADSTATUS_WAIT_HLE_EVENT) {
133 118
134 // Remove the thread from each of its waiting objects' waitlists 119 // Remove the thread from each of its waiting objects' waitlists
135 for (auto& object : thread->wait_objects) 120 for (auto& object : thread->wait_objects)
@@ -163,7 +148,7 @@ void Thread::ResumeFromWait() {
163 switch (status) { 148 switch (status) {
164 case THREADSTATUS_WAIT_SYNCH_ALL: 149 case THREADSTATUS_WAIT_SYNCH_ALL:
165 case THREADSTATUS_WAIT_SYNCH_ANY: 150 case THREADSTATUS_WAIT_SYNCH_ANY:
166 case THREADSTATUS_WAIT_ARB: 151 case THREADSTATUS_WAIT_HLE_EVENT:
167 case THREADSTATUS_WAIT_SLEEP: 152 case THREADSTATUS_WAIT_SLEEP:
168 case THREADSTATUS_WAIT_IPC: 153 case THREADSTATUS_WAIT_IPC:
169 break; 154 break;