Luna/kernel/src/thread/Thread.cpp
2023-01-02 13:07:29 +01:00

22 lines
309 B
C++

#include "thread/Thread.h"
#include <luna/Alloc.h>
#include <luna/Atomic.h>
static Atomic<u64> g_next_id;
LinkedList<Thread> g_threads;
void Thread::init()
{
g_next_id = 1;
}
Result<Thread*> new_thread()
{
Thread* thread = TRY(make<Thread>());
thread->id = g_next_id++;
return thread;
}