-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkthread.h
More file actions
36 lines (26 loc) · 903 Bytes
/
kthread.h
File metadata and controls
36 lines (26 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef KTHREAD_H
#define KTHREAD_H
#define NTHREAD 16
#define MAX_MUTEXES 64
int kthread_create(void* (start_func)(),void* stack,int stack_size);
int kthread_id();
void kthread_exit();
int kthread_join();
int kthread_mutex_alloc();
int kthread_mutex_dealloc(int mutex_id);
int kthread_mutex_lock(int mutex_id);
int kthread_mutex_unlock(int mutex_id);
int kthread_mutex_num(int mutex_id);
enum procstate { UNUSED, EMBRYO, SLEEPING, RUNNABLE, RUNNING, ZOMBIE };
struct thread{
int id;
char *kstack; // Bottom of kernel stack for this Thread
enum procstate state; // Thread state
struct proc* process; // Parent process
struct trapframe *tf; // Trap frame for current syscall
struct context *context; // swtch() here to run process
void *chan; // If non-zero, sleeping on chan
int killed;
struct thread* list;
};
#endif