diff options
Diffstat (limited to 'src/threads/thread.h')
| -rw-r--r-- | src/threads/thread.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/threads/thread.h b/src/threads/thread.h index e3c426d..b822b64 100644 --- a/src/threads/thread.h +++ b/src/threads/thread.h @@ -4,6 +4,7 @@ #include <debug.h> #include <list.h> #include <stdint.h> +#include "threads/synch.h" #define MAX_FDS 128 /* Max number of file descriptors per thread */ @@ -21,6 +22,24 @@ enum thread_status typedef int tid_t; #define TID_ERROR ((tid_t) -1) /* Error value for tid_t. */ +/* The relationship between a parent and child process. + It is setup by the child in + The child reports its exit status by setting exit_status + and upping exit_sema. + The parent places the parent_child element in its list of children. +*/ +struct parent_child + { + struct list_elem elem; // owned by the parent + + struct semaphore exit_sema; + + struct lock l; + int exit_status; + int alive_count; + + }; + /* Thread priorities. */ #define PRI_MIN 0 /* Lowest priority. */ #define PRI_DEFAULT 31 /* Default priority. */ @@ -98,7 +117,10 @@ struct thread #ifdef USERPROG /* Owned by userprog/process.c. */ uint32_t *pagedir; /* Page directory. */ - struct file **fds; /* Pointer to array of file descriptors. */ + struct file **fds; /* Pointer to array of file descriptors. */ + + struct parent_child parent; // one parent + struct list children; // multiple children #endif /* Owned by thread.c. */ |
