mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-24 01:30:10 +00:00
Thread: Remove the last Handle-based interfaces from Thread.cpp
This commit is contained in:
parent
5619e790b8
commit
c91d2e959b
@ -40,11 +40,11 @@ ResultCode ArbitrateAddress(Handle handle, ArbitrationType type, u32 address, s3
|
||||
case ArbitrationType::Signal:
|
||||
// Negative value means resume all threads
|
||||
if (value < 0) {
|
||||
ArbitrateAllThreads(handle, address);
|
||||
ArbitrateAllThreads(object, address);
|
||||
} else {
|
||||
// Resume first N threads
|
||||
for(int i = 0; i < value; i++)
|
||||
ArbitrateHighestPriorityThread(handle, address);
|
||||
ArbitrateHighestPriorityThread(object, address);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -152,39 +152,38 @@ void ChangeThreadState(Thread* t, ThreadStatus new_status) {
|
||||
}
|
||||
|
||||
/// Arbitrate the highest priority thread that is waiting
|
||||
Handle ArbitrateHighestPriorityThread(Handle arbiter, u32 address) {
|
||||
Handle highest_priority_thread = 0;
|
||||
Thread* ArbitrateHighestPriorityThread(Object* arbiter, u32 address) {
|
||||
Thread* highest_priority_thread = nullptr;
|
||||
s32 priority = THREADPRIO_LOWEST;
|
||||
|
||||
// Iterate through threads, find highest priority thread that is waiting to be arbitrated...
|
||||
for (Thread* thread : thread_queue) {
|
||||
if (!CheckWaitType(thread, WAITTYPE_ARB, Kernel::g_handle_table.GetGeneric(arbiter), address))
|
||||
if (!CheckWaitType(thread, WAITTYPE_ARB, arbiter, address))
|
||||
continue;
|
||||
|
||||
if (thread == nullptr)
|
||||
continue; // TODO(yuriks): Thread handle will hang around forever. Should clean up.
|
||||
|
||||
if(thread->current_priority <= priority) {
|
||||
highest_priority_thread = thread->GetHandle();
|
||||
highest_priority_thread = thread;
|
||||
priority = thread->current_priority;
|
||||
}
|
||||
}
|
||||
|
||||
// If a thread was arbitrated, resume it
|
||||
if (0 != highest_priority_thread) {
|
||||
Thread* thread = Kernel::g_handle_table.Get<Thread>(highest_priority_thread);
|
||||
if (thread != nullptr)
|
||||
thread->ResumeFromWait();
|
||||
if (nullptr != highest_priority_thread) {
|
||||
highest_priority_thread->ResumeFromWait();
|
||||
}
|
||||
|
||||
return highest_priority_thread;
|
||||
}
|
||||
|
||||
/// Arbitrate all threads currently waiting
|
||||
void ArbitrateAllThreads(Handle arbiter, u32 address) {
|
||||
void ArbitrateAllThreads(Object* arbiter, u32 address) {
|
||||
|
||||
// Iterate through threads, find highest priority thread that is waiting to be arbitrated...
|
||||
for (Thread* thread : thread_queue) {
|
||||
if (CheckWaitType(thread, WAITTYPE_ARB, Kernel::g_handle_table.GetGeneric(arbiter), address))
|
||||
if (CheckWaitType(thread, WAITTYPE_ARB, arbiter, address))
|
||||
thread->ResumeFromWait();
|
||||
}
|
||||
}
|
||||
|
@ -112,10 +112,10 @@ Thread* SetupMainThread(s32 priority, int stack_size = Kernel::DEFAULT_STACK_SIZ
|
||||
void Reschedule();
|
||||
|
||||
/// Arbitrate the highest priority thread that is waiting
|
||||
Handle ArbitrateHighestPriorityThread(Handle arbiter, u32 address);
|
||||
Thread* ArbitrateHighestPriorityThread(Object* arbiter, u32 address);
|
||||
|
||||
/// Arbitrate all threads currently waiting...
|
||||
void ArbitrateAllThreads(Handle arbiter, u32 address);
|
||||
void ArbitrateAllThreads(Object* arbiter, u32 address);
|
||||
|
||||
/// Gets the current thread
|
||||
Thread* GetCurrentThread();
|
||||
|
Loading…
Reference in New Issue
Block a user