22 lines
309 B
C++
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;
|
|
}
|