35 lines
921 B
C
35 lines
921 B
C
// This file is part of noxos and licensed under the MIT open source license
|
|
|
|
#ifndef NOX_THREAD_H
|
|
#define NOX_THREAD_H
|
|
|
|
#include "utils/stdtypes.h"
|
|
#include "platform/cpu.h"
|
|
#include "proc/process.h"
|
|
|
|
typedef struct thread_T thread_T;
|
|
struct thread_T{
|
|
cpu_state_T* state;
|
|
uint64_t cpu_time;
|
|
void* stack;
|
|
uint32_t stack_size;
|
|
process_T* process;
|
|
|
|
// Scheduling data
|
|
thread_T* global_prev;
|
|
thread_T* global_next;
|
|
|
|
thread_T* local_prev;
|
|
thread_T* local_next;
|
|
uint32_t local_id;
|
|
};
|
|
|
|
|
|
thread_T* thread_spawn (pid_t process, void* function);
|
|
thread_T* thread_spawn_from_state (pid_t process, cpu_state_T* state);
|
|
void thread_start (thread_T* thread);
|
|
void thread_pause (thread_T* thread);
|
|
void thread_kill (thread_T* thread);
|
|
|
|
#endif //NOX_THREAD_H
|