Browse Source

added another condition to thread to allow for threads to die if their process has exited but exists because it wants to be usable by family|
|

tarfeef101 6 years ago
parent
commit
0e648f4fd6

BIN
kern/compile/ASST2/kernel


+ 1 - 1
kern/compile/ASST2/vers.c

@@ -1,3 +1,3 @@
 /* This file is automatically generated. Edits will be lost.*/
-const int buildversion = 63;
+const int buildversion = 66;
 const char buildconfig[] = "ASST2";

+ 1 - 1
kern/compile/ASST2/version

@@ -1 +1 @@
-63
+66

+ 1 - 1
kern/syscall/proc_syscalls.c

@@ -140,7 +140,7 @@ void sys__exit(int exitcode)
   /* if this is the last user process in the system, proc_destroy()
      will wake up the kernel menu thread */
   //proc_destroy(p);
-  thread_exit();
+  if (!(curproc)) thread_exit();
   /* thread_exit() does not return, so we should never get here */
   panic("return from thread_exit in sys_exit\n");
 }

+ 1 - 1
kern/thread/thread.c

@@ -788,7 +788,7 @@ thread_exit(void)
 #ifdef UW
 	/* threads for user processes should have detached from their process
 	   in sys__exit */
-	KASSERT(curproc == kproc || curproc == NULL);
+	KASSERT(curproc == kproc || curproc == NULL || curproc->exitcode != -1);
 	/* kernel threads don't go through sys__exit, so we detach them from kproc here */
 	if (curproc == kproc) {
 	  proc_remthread(cur);