X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fthreads%2Fthread.h;h=aab1a73902410757eac49b628ecf2e58670bc978;hb=828d300fd2039b686b69244c2bd6f8b87645086d;hp=9251ad88cb3c47ec1190099a9d2511dc99f93da3;hpb=44d0fa6a2b24a84e5eb0d54959ed91c1d4f15343;p=pintos-anon diff --git a/src/threads/thread.h b/src/threads/thread.h index 9251ad8..aab1a73 100644 --- a/src/threads/thread.h +++ b/src/threads/thread.h @@ -19,34 +19,36 @@ enum thread_status struct thread { - enum thread_status status; - char name[16]; - uint8_t *stack; - list_elem rq_elem; + /* These members are owned by the thread_*() functions. */ + enum thread_status status; /* Thread state. */ + char name[16]; /* Name (for debugging purposes). */ + uint8_t *stack; /* Saved stack pointer. */ + list_elem rq_elem; /* Run queue list element. */ + #ifdef USERPROG - struct addrspace addrspace; + /* These members are owned by the addrspace_*() functions. */ + uint32_t *pagedir; /* Page directory. */ #endif + + /* Marker to detect stack overflow. */ + unsigned magic; /* Always set to THREAD_MAGIC. */ }; void thread_init (void); +void thread_start (void); -struct thread *thread_create (const char *name, - void (*function) (void *aux), void *aux); -void thread_destroy (struct thread *); -struct thread *thread_current (void); - +typedef void thread_func (void *aux); +struct thread *thread_create (const char *name, thread_func *, void *); #ifdef USERPROG bool thread_execute (const char *filename); #endif -void thread_start (struct thread *); -void thread_ready (struct thread *); -void thread_exit (void) NO_RETURN; +void thread_wake (struct thread *); +const char *thread_name (struct thread *); +struct thread *thread_current (void); +void thread_exit (void) NO_RETURN; void thread_yield (void); void thread_sleep (void); -void thread_schedule (void); - -void thread_self_test (void); #endif /* thread.h */