mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-15 06:50:06 +00:00
kernel/thread: move next_thread_id into manager
This commit is contained in:
parent
34f1fe088c
commit
876729ab52
@ -48,14 +48,7 @@ static Common::ThreadQueueList<Thread*, ThreadPrioLowest + 1> ready_queue;
|
||||
|
||||
static SharedPtr<Thread> current_thread;
|
||||
|
||||
// The first available thread id at startup
|
||||
static u32 next_thread_id;
|
||||
|
||||
/**
|
||||
* Creates a new thread ID
|
||||
* @return The new thread ID
|
||||
*/
|
||||
inline static u32 const NewThreadId() {
|
||||
u32 ThreadManager::NewThreadId() {
|
||||
return next_thread_id++;
|
||||
}
|
||||
|
||||
@ -348,7 +341,7 @@ ResultVal<SharedPtr<Thread>> KernelSystem::CreateThread(std::string name, VAddr
|
||||
thread_list.push_back(thread);
|
||||
ready_queue.prepare(priority);
|
||||
|
||||
thread->thread_id = NewThreadId();
|
||||
thread->thread_id = thread_manager->NewThreadId();
|
||||
thread->status = ThreadStatus::Dormant;
|
||||
thread->entry_point = entry_point;
|
||||
thread->stack_top = stack_top;
|
||||
@ -504,7 +497,6 @@ void ThreadingInit() {
|
||||
ThreadWakeupEventType = CoreTiming::RegisterEvent("ThreadWakeupCallback", ThreadWakeupCallback);
|
||||
|
||||
current_thread = nullptr;
|
||||
next_thread_id = 1;
|
||||
}
|
||||
|
||||
void ThreadingShutdown() {
|
||||
|
@ -55,6 +55,14 @@ enum class ThreadWakeupReason {
|
||||
|
||||
class ThreadManager {
|
||||
public:
|
||||
/**
|
||||
* Creates a new thread ID
|
||||
* @return The new thread ID
|
||||
*/
|
||||
u32 NewThreadId();
|
||||
|
||||
private:
|
||||
u32 next_thread_id = 1;
|
||||
};
|
||||
|
||||
class Thread final : public WaitObject {
|
||||
|
Loading…
Reference in New Issue
Block a user