os/kernel/cpu/i386/tasking.h

41 lines
742 B
C
Raw Normal View History

2019-02-11 09:30:28 -06:00
#ifndef INT_TASKING_H
#define INT_TASKING_H
#include <stdint.h>
2020-07-12 14:28:58 -05:00
#ifndef TASKING_H
2020-07-20 09:51:30 -05:00
typedef enum ThreadState {
THREAD_RUNNING,
THREAD_READY,
THREAD_EXITED,
THREAD_BLOCKED
} ThreadState;
2020-07-12 14:28:58 -05:00
#endif
2020-07-20 09:51:30 -05:00
struct Thread;
typedef struct Process {
char priv;
uint32_t pid;
uint32_t next_tid;
int numThreads;
int numThreadsBlocked;
struct Thread* firstThread;
} Process;
typedef struct Thread {
2019-05-21 19:16:19 -05:00
uint32_t kernel_esp;
uint32_t kernel_esp_top;
2020-07-20 09:51:30 -05:00
void* cr3; //In thread to make the task switch asm easier
uint32_t tid;
ThreadState state;
2019-05-11 10:11:28 -05:00
int errno;
2020-07-20 09:51:30 -05:00
struct Thread* nextThreadInProcess;
struct Thread* prevThreadInProcess;
struct Thread* nextReadyToRun;
struct Thread* prevReadyToRun;
Process* process;
} Thread;
2019-02-11 09:30:28 -06:00
#endif