We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 99ab26e commit 5dd14a8Copy full SHA for 5dd14a8
src/include/kernel/sched.h
@@ -120,6 +120,7 @@ int schedException(pid_t, pid_t);
120
void terminateThread(Thread *, int, bool);
121
void schedSleepTimer();
122
Thread *getKernelThread();
123
+void threadCleanup(Thread *);
124
125
// these functions are exposed as system calls, but some will need to take
126
// the thread as an argument from the system call handler - the actual user
src/sched/waitpid.c
@@ -27,7 +27,12 @@ static pid_t processStatus(Process *p, int *status) {
27
if((!t->clean) && (t->status == THREAD_ZOMBIE)) {
28
t->clean = true;
29
*status = t->exitStatus;
30
- return t->tid;
+ pid_t pid = t->tid;
31
+
32
+ // free the thread structure
33
+ threadCleanup(t);
34
35
+ return pid;
36
}
37
38
0 commit comments