wip: thread and processes handle
This commit is contained in:
27
headers/thread.h
Normal file
27
headers/thread.h
Normal file
@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include "process.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define STACK_SIZE PAGE_SIZE * 4
|
||||
|
||||
typedef enum {
|
||||
NEW,
|
||||
RUNNING,
|
||||
WAITING,
|
||||
STOPPED,
|
||||
} state_t;
|
||||
|
||||
struct tcb {
|
||||
uint8_t *esp;
|
||||
uint8_t *esp0;
|
||||
uint16_t tid;
|
||||
state_t state;
|
||||
struct pcb *process;
|
||||
struct tcb *next;
|
||||
};
|
||||
|
||||
struct tcb *create_thread(struct pcb *process, void (*routine)(void));
|
||||
void delete_thread(struct tcb *thread);
|
||||
void switch_thread(struct tcb *thread_to_switch);
|
||||
Reference in New Issue
Block a user