Add copyright notice to synch.h.
[pintos-anon] / src / threads / thread.h
index a70b48b50cb0305f2147089a0b4db17948e8de46..421751be943f90bd7ad080b3dae9aecdb593d095 100644 (file)
@@ -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. */