From 47d2b85f8271b30ad3dbdceb30f2ade98647b56e Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 5 Apr 2006 19:25:49 +0000 Subject: [PATCH] Add comment to explain why we don't free initial_thread. Thanks to Sunit Pal for the question. --- src/threads/thread.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/threads/thread.c b/src/threads/thread.c index 01e8ea4..16b8c8b 100644 --- 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 - 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); - if (prev != initial_thread) - palloc_free_page (prev); + palloc_free_page (prev); } } -- 2.30.2