diff --git a/src/threads/thread.c b/src/threads/thread.c index 0073037..214a458 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -15,11 +15,13 @@ #include "threads/switch.h" #include "threads/synch.h" #include "threads/vaddr.h" -#include "vm/page.h" -#include "vm/mmap.h" #ifdef USERPROG #include "userprog/process.h" #include "userprog/syscall.h" +#include "vm/page.h" +#endif +#ifdef VM +#include "vm/mmap.h" #endif /* Random value for struct thread's `magic' member. @@ -275,7 +277,9 @@ thread_create (const char *name, int priority, } #endif +#ifdef VM mmap_init (); +#endif /* Prepare thread for first run by initializing its stack. Do this atomically so intermediate values for the 'stack' @@ -397,7 +401,9 @@ thread_exit (void) process_exit (); #endif +#ifdef VM mmap_destroy (); +#endif /* Remove thread from all threads list, set our status to dying, and schedule another process. That process will destroy us