Initial revision
[pintos-anon] / src / threads / thread.h
1 #ifndef HEADER_THREAD_H
2 #define HEADER_THREAD_H 1
3
4 #include <stdint.h>
5 #include "list.h"
6
7 enum thread_status 
8   {
9     THREAD_RUNNING,
10     THREAD_READY,
11     THREAD_BLOCKED,
12     THREAD_DYING
13   };
14
15 struct thread 
16   {
17     enum thread_status status;
18     char name[16];
19     uint32_t *stack;
20     struct list_elem rq_elem;
21   };
22
23 void thread_init (void);
24
25 struct thread *thread_create (const char *name,
26                               void (*function) (void *aux), void *aux);
27 void thread_destroy (struct thread *);
28 struct thread *thread_current (void);
29
30 void thread_start (struct thread *);
31 void thread_ready (struct thread *);
32 void thread_exit (void);
33
34 void thread_yield (void);
35 void thread_sleep (void);
36 void thread_schedule (void);
37
38 #endif /* thread.h */