Kernel/Thread: move thread queue, current thread, and scheduling related function into the manager
As we touched it, remove IPC::GetCommandBuffer
This commit is contained in:
parent
876729ab52
commit
0478bc3dee
14 changed files with 123 additions and 146 deletions
|
@ -10,6 +10,7 @@
|
|||
#include <boost/container/flat_map.hpp>
|
||||
#include <boost/container/flat_set.hpp>
|
||||
#include "common/common_types.h"
|
||||
#include "common/thread_queue_list.h"
|
||||
#include "core/arm/arm_interface.h"
|
||||
#include "core/hle/kernel/object.h"
|
||||
#include "core/hle/kernel/wait_object.h"
|
||||
|
@ -61,8 +62,55 @@ public:
|
|||
*/
|
||||
u32 NewThreadId();
|
||||
|
||||
/**
|
||||
* Gets the current thread
|
||||
*/
|
||||
Thread* GetCurrentThread() const;
|
||||
|
||||
/**
|
||||
* Reschedules to the next available thread (call after current thread is suspended)
|
||||
*/
|
||||
void Reschedule();
|
||||
|
||||
/**
|
||||
* Prints the thread queue for debugging purposes
|
||||
*/
|
||||
void DebugThreadQueue();
|
||||
|
||||
/**
|
||||
* Returns whether there are any threads that are ready to run.
|
||||
*/
|
||||
bool HaveReadyThreads();
|
||||
|
||||
/**
|
||||
* Waits the current thread on a sleep
|
||||
*/
|
||||
void WaitCurrentThread_Sleep();
|
||||
|
||||
/**
|
||||
* Stops the current thread and removes it from the thread_list
|
||||
*/
|
||||
void ExitCurrentThread();
|
||||
|
||||
private:
|
||||
/**
|
||||
* Switches the CPU's active thread context to that of the specified thread
|
||||
* @param new_thread The thread to switch to
|
||||
*/
|
||||
void SwitchContext(Thread* new_thread);
|
||||
|
||||
/**
|
||||
* Pops and returns the next thread from the thread queue
|
||||
* @return A pointer to the next ready thread
|
||||
*/
|
||||
Thread* PopNextReadyThread();
|
||||
|
||||
u32 next_thread_id = 1;
|
||||
SharedPtr<Thread> current_thread;
|
||||
Common::ThreadQueueList<Thread*, ThreadPrioLowest + 1> ready_queue;
|
||||
|
||||
friend class Thread;
|
||||
friend class KernelSystem;
|
||||
};
|
||||
|
||||
class Thread final : public WaitObject {
|
||||
|
@ -238,43 +286,6 @@ private:
|
|||
SharedPtr<Thread> SetupMainThread(KernelSystem& kernel, u32 entry_point, u32 priority,
|
||||
SharedPtr<Process> owner_process);
|
||||
|
||||
/**
|
||||
* Returns whether there are any threads that are ready to run.
|
||||
*/
|
||||
bool HaveReadyThreads();
|
||||
|
||||
/**
|
||||
* Reschedules to the next available thread (call after current thread is suspended)
|
||||
*/
|
||||
void Reschedule();
|
||||
|
||||
/**
|
||||
* Arbitrate the highest priority thread that is waiting
|
||||
* @param address The address for which waiting threads should be arbitrated
|
||||
*/
|
||||
Thread* ArbitrateHighestPriorityThread(u32 address);
|
||||
|
||||
/**
|
||||
* Arbitrate all threads currently waiting.
|
||||
* @param address The address for which waiting threads should be arbitrated
|
||||
*/
|
||||
void ArbitrateAllThreads(u32 address);
|
||||
|
||||
/**
|
||||
* Gets the current thread
|
||||
*/
|
||||
Thread* GetCurrentThread();
|
||||
|
||||
/**
|
||||
* Waits the current thread on a sleep
|
||||
*/
|
||||
void WaitCurrentThread_Sleep();
|
||||
|
||||
/**
|
||||
* Stops the current thread and removes it from the thread_list
|
||||
*/
|
||||
void ExitCurrentThread();
|
||||
|
||||
/**
|
||||
* Initialize threading
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue