kernel/Thread: move thread wake up table and callback handle into the manager

This commit is contained in:
Weiyi Wang 2018-10-23 11:57:59 -04:00
parent 0478bc3dee
commit 7fc61920cc
3 changed files with 25 additions and 24 deletions

View file

@ -12,6 +12,7 @@
#include "common/common_types.h"
#include "common/thread_queue_list.h"
#include "core/arm/arm_interface.h"
#include "core/core_timing.h"
#include "core/hle/kernel/object.h"
#include "core/hle/kernel/wait_object.h"
#include "core/hle/result.h"
@ -56,6 +57,8 @@ enum class ThreadWakeupReason {
class ThreadManager {
public:
ThreadManager();
/**
* Creates a new thread ID
* @return The new thread ID
@ -105,9 +108,20 @@ private:
*/
Thread* PopNextReadyThread();
/**
* Callback that will wake up the thread it was scheduled for
* @param thread_id The ID of the thread that's been awoken
* @param cycles_late The number of CPU cycles that have passed since the desired wakeup time
*/
void ThreadWakeupCallback(u64 thread_id, s64 cycles_late);
u32 next_thread_id = 1;
SharedPtr<Thread> current_thread;
Common::ThreadQueueList<Thread*, ThreadPrioLowest + 1> ready_queue;
std::unordered_map<u64, Thread*> wakeup_callback_table;
/// Event type for the thread wake up event
CoreTiming::EventType* ThreadWakeupEventType = nullptr;
friend class Thread;
friend class KernelSystem;
@ -286,11 +300,6 @@ private:
SharedPtr<Thread> SetupMainThread(KernelSystem& kernel, u32 entry_point, u32 priority,
SharedPtr<Process> owner_process);
/**
* Initialize threading
*/
void ThreadingInit();
/**
* Shutdown threading
*/