Fix up header guards.
[pintos-anon] / src / threads / thread.h
index a70b48b50cb0305f2147089a0b4db17948e8de46..95173ffa51fe6f771a25b70ba135b12df090e00c 100644 (file)
@@ -1,12 +1,12 @@
-#ifndef HEADER_THREAD_H
-#define HEADER_THREAD_H 1
+#ifndef THREADS_THREAD_H
+#define THREADS_THREAD_H
 
+#include <debug.h>
+#include <list.h>
 #include <stdint.h>
-#include "debug.h"
-#include "list.h"
 
 #ifdef USERPROG
-#include "addrspace.h"
+#include "userprog/addrspace.h"
 #endif
 
 /* States in a thread's life cycle. */
@@ -68,13 +68,19 @@ enum thread_status
    the `magic' member of the running thread's `struct thread' is
    set to THREAD_MAGIC.  Stack overflow will normally change this
    value, triggering the assertion. */
+/* The `elem' member has a dual purpose.  It can be an element in
+   the run queue (thread.c), or it can be an element in a
+   semaphore wait list (synch.c).  It can be used these two ways
+   only because they are mutually exclusive: only a thread in the
+   ready state is on the run queue, whereas only a thread in the
+   blocked state is on a semaphore wait list. */
 struct thread
   {
     /* 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. */
+    list_elem elem;                     /* List element. */
 
 #ifdef USERPROG
     /* These members are owned by the addrspace_*() functions. */
@@ -102,4 +108,4 @@ void thread_exit (void) NO_RETURN;
 void thread_yield (void);
 void thread_block (void);
 
-#endif /* thread.h */
+#endif /* threads/thread.h */