projects
/
pintos-anon
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add comment to explain why we don't free initial_thread.
[pintos-anon]
/
src
/
threads
/
thread.c
diff --git
a/src/threads/thread.c
b/src/threads/thread.c
index 01e8ea42919913a8c5219221c01f52a38f5f1d3e..16b8c8b692e8664b81bab789eb3eeb946e38f3b7 100644
(file)
--- a/
src/threads/thread.c
+++ b/
src/threads/thread.c
@@
-483,12
+483,13
@@
schedule_tail (struct thread *prev)
/* If the thread we switched from is dying, destroy its struct
thread. This must happen late so that thread_exit() doesn't
/* If the thread we switched from is dying, destroy its struct
thread. This must happen late so that thread_exit() doesn't
- pull out the rug under itself. */
- if (prev != NULL && prev->status == THREAD_DYING)
+ pull out the rug under itself. (We don't free
+ initial_thread because its memory was not obtained via
+ palloc().) */
+ if (prev != NULL && prev->status == THREAD_DYING && prev != initial_thread)
{
ASSERT (prev != cur);
{
ASSERT (prev != cur);
- if (prev != initial_thread)
- palloc_free_page (prev);
+ palloc_free_page (prev);
}
}
}
}