summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/thread.cpp
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2014-12-13 21:16:13 -0200
committerGravatar Yuri Kunde Schlesner2014-12-28 11:52:52 -0200
commit73fba22c019562687c6e14f20ca7422020f7e070 (patch)
tree605504e9e6306752023ce8bfbff9599c2eab957e /src/core/hle/kernel/thread.cpp
parentMerge pull request #349 from lioncash/uhdync (diff)
downloadyuzu-73fba22c019562687c6e14f20ca7422020f7e070.tar.gz
yuzu-73fba22c019562687c6e14f20ca7422020f7e070.tar.xz
yuzu-73fba22c019562687c6e14f20ca7422020f7e070.zip
Rename ObjectPool to HandleTable
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
-rw-r--r--src/core/hle/kernel/thread.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index c6a8dc7b9..c89d9433a 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -164,7 +164,7 @@ static bool CheckWaitType(const Thread* thread, WaitType type, Handle wait_handl
164 164
165/// Stops the current thread 165/// Stops the current thread
166ResultCode StopThread(Handle handle, const char* reason) { 166ResultCode StopThread(Handle handle, const char* reason) {
167 Thread* thread = g_object_pool.Get<Thread>(handle); 167 Thread* thread = g_handle_table.Get<Thread>(handle);
168 if (thread == nullptr) return InvalidHandle(ErrorModule::Kernel); 168 if (thread == nullptr) return InvalidHandle(ErrorModule::Kernel);
169 169
170 // Release all the mutexes that this thread holds 170 // Release all the mutexes that this thread holds
@@ -173,7 +173,7 @@ ResultCode StopThread(Handle handle, const char* reason) {
173 ChangeReadyState(thread, false); 173 ChangeReadyState(thread, false);
174 thread->status = THREADSTATUS_DORMANT; 174 thread->status = THREADSTATUS_DORMANT;
175 for (Handle waiting_handle : thread->waiting_threads) { 175 for (Handle waiting_handle : thread->waiting_threads) {
176 Thread* waiting_thread = g_object_pool.Get<Thread>(waiting_handle); 176 Thread* waiting_thread = g_handle_table.Get<Thread>(waiting_handle);
177 177
178 if (CheckWaitType(waiting_thread, WAITTYPE_THREADEND, handle)) 178 if (CheckWaitType(waiting_thread, WAITTYPE_THREADEND, handle))
179 ResumeThreadFromWait(waiting_handle); 179 ResumeThreadFromWait(waiting_handle);
@@ -210,7 +210,7 @@ Handle ArbitrateHighestPriorityThread(u32 arbiter, u32 address) {
210 210
211 // Iterate through threads, find highest priority thread that is waiting to be arbitrated... 211 // Iterate through threads, find highest priority thread that is waiting to be arbitrated...
212 for (Handle handle : thread_queue) { 212 for (Handle handle : thread_queue) {
213 Thread* thread = g_object_pool.Get<Thread>(handle); 213 Thread* thread = g_handle_table.Get<Thread>(handle);
214 214
215 if (!CheckWaitType(thread, WAITTYPE_ARB, arbiter, address)) 215 if (!CheckWaitType(thread, WAITTYPE_ARB, arbiter, address))
216 continue; 216 continue;
@@ -235,7 +235,7 @@ void ArbitrateAllThreads(u32 arbiter, u32 address) {
235 235
236 // Iterate through threads, find highest priority thread that is waiting to be arbitrated... 236 // Iterate through threads, find highest priority thread that is waiting to be arbitrated...
237 for (Handle handle : thread_queue) { 237 for (Handle handle : thread_queue) {
238 Thread* thread = g_object_pool.Get<Thread>(handle); 238 Thread* thread = g_handle_table.Get<Thread>(handle);
239 239
240 if (CheckWaitType(thread, WAITTYPE_ARB, arbiter, address)) 240 if (CheckWaitType(thread, WAITTYPE_ARB, arbiter, address))
241 ResumeThreadFromWait(handle); 241 ResumeThreadFromWait(handle);
@@ -288,7 +288,7 @@ Thread* NextThread() {
288 if (next == 0) { 288 if (next == 0) {
289 return nullptr; 289 return nullptr;
290 } 290 }
291 return Kernel::g_object_pool.Get<Thread>(next); 291 return Kernel::g_handle_table.Get<Thread>(next);
292} 292}
293 293
294void WaitCurrentThread(WaitType wait_type, Handle wait_handle) { 294void WaitCurrentThread(WaitType wait_type, Handle wait_handle) {
@@ -305,7 +305,7 @@ void WaitCurrentThread(WaitType wait_type, Handle wait_handle, VAddr wait_addres
305 305
306/// Resumes a thread from waiting by marking it as "ready" 306/// Resumes a thread from waiting by marking it as "ready"
307void ResumeThreadFromWait(Handle handle) { 307void ResumeThreadFromWait(Handle handle) {
308 Thread* thread = Kernel::g_object_pool.Get<Thread>(handle); 308 Thread* thread = Kernel::g_handle_table.Get<Thread>(handle);
309 if (thread) { 309 if (thread) {
310 thread->status &= ~THREADSTATUS_WAIT; 310 thread->status &= ~THREADSTATUS_WAIT;
311 thread->wait_handle = 0; 311 thread->wait_handle = 0;
@@ -341,7 +341,7 @@ Thread* CreateThread(Handle& handle, const char* name, u32 entry_point, s32 prio
341 341
342 Thread* thread = new Thread; 342 Thread* thread = new Thread;
343 343
344 handle = Kernel::g_object_pool.Create(thread); 344 handle = Kernel::g_handle_table.Create(thread);
345 345
346 thread_queue.push_back(handle); 346 thread_queue.push_back(handle);
347 thread_ready_queue.prepare(priority); 347 thread_ready_queue.prepare(priority);
@@ -398,7 +398,7 @@ Handle CreateThread(const char* name, u32 entry_point, s32 priority, u32 arg, s3
398 398
399/// Get the priority of the thread specified by handle 399/// Get the priority of the thread specified by handle
400ResultVal<u32> GetThreadPriority(const Handle handle) { 400ResultVal<u32> GetThreadPriority(const Handle handle) {
401 Thread* thread = g_object_pool.Get<Thread>(handle); 401 Thread* thread = g_handle_table.Get<Thread>(handle);
402 if (thread == nullptr) return InvalidHandle(ErrorModule::Kernel); 402 if (thread == nullptr) return InvalidHandle(ErrorModule::Kernel);
403 403
404 return MakeResult<u32>(thread->current_priority); 404 return MakeResult<u32>(thread->current_priority);
@@ -410,7 +410,7 @@ ResultCode SetThreadPriority(Handle handle, s32 priority) {
410 if (!handle) { 410 if (!handle) {
411 thread = GetCurrentThread(); // TODO(bunnei): Is this correct behavior? 411 thread = GetCurrentThread(); // TODO(bunnei): Is this correct behavior?
412 } else { 412 } else {
413 thread = g_object_pool.Get<Thread>(handle); 413 thread = g_handle_table.Get<Thread>(handle);
414 if (thread == nullptr) { 414 if (thread == nullptr) {
415 return InvalidHandle(ErrorModule::Kernel); 415 return InvalidHandle(ErrorModule::Kernel);
416 } 416 }
@@ -481,7 +481,7 @@ void Reschedule() {
481 LOG_TRACE(Kernel, "cannot context switch from 0x%08X, no higher priority thread!", prev->GetHandle()); 481 LOG_TRACE(Kernel, "cannot context switch from 0x%08X, no higher priority thread!", prev->GetHandle());
482 482
483 for (Handle handle : thread_queue) { 483 for (Handle handle : thread_queue) {
484 Thread* thread = g_object_pool.Get<Thread>(handle); 484 Thread* thread = g_handle_table.Get<Thread>(handle);
485 LOG_TRACE(Kernel, "\thandle=0x%08X prio=0x%02X, status=0x%08X wait_type=0x%08X wait_handle=0x%08X", 485 LOG_TRACE(Kernel, "\thandle=0x%08X prio=0x%02X, status=0x%08X wait_type=0x%08X wait_handle=0x%08X",
486 thread->GetHandle(), thread->current_priority, thread->status, thread->wait_type, thread->wait_handle); 486 thread->GetHandle(), thread->current_priority, thread->status, thread->wait_type, thread->wait_handle);
487 } 487 }
@@ -497,7 +497,7 @@ void Reschedule() {
497} 497}
498 498
499ResultCode GetThreadId(u32* thread_id, Handle handle) { 499ResultCode GetThreadId(u32* thread_id, Handle handle) {
500 Thread* thread = g_object_pool.Get<Thread>(handle); 500 Thread* thread = g_handle_table.Get<Thread>(handle);
501 if (thread == nullptr) 501 if (thread == nullptr)
502 return ResultCode(ErrorDescription::InvalidHandle, ErrorModule::OS, 502 return ResultCode(ErrorDescription::InvalidHandle, ErrorModule::OS,
503 ErrorSummary::WrongArgument, ErrorLevel::Permanent); 503 ErrorSummary::WrongArgument, ErrorLevel::Permanent);