From 2c1cccc529737527ad9ef981952d2c14d3dd13ec Mon Sep 17 00:00:00 2001 From: Flávio Cruz Date: Fri, 28 Aug 2015 01:34:01 +0200 Subject: Make sure the reply port's reference is released when the thread needs to be halted. * kern/thread.h (thread_halt_self): Add continuation_t parameter. * kern/thread.c (thread_halt_self): Pass continuation_t parameter to thread_block instead of thread_exception_return. * kern/ast.c (ast_taken): Pass thread_exception_return to thread_halt_self. * kern/profile.c (profile_thread): Likewise. * kern/exception.c (exception_no_server): Likewise. (thread_release_and_exception_return): New function. (exception_raise_continue_slow): Pass thread_release_and_exception_return to thread_halt_self. --- kern/thread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'kern/thread.c') diff --git a/kern/thread.c b/kern/thread.c index c638075..3e90079 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -1132,7 +1132,7 @@ void __attribute__((noreturn)) walking_zombie(void) * Thread calls this routine on exit from the kernel when it * notices a halt request. */ -void thread_halt_self(void) +void thread_halt_self(continuation_t continuation) { thread_t thread = current_thread(); spl_t s; @@ -1173,7 +1173,7 @@ void thread_halt_self(void) thread_unlock(thread); splx(s); counter(c_thread_halt_self_block++); - thread_block(thread_exception_return); + thread_block(continuation); /* * thread_release resets TH_HALTED. */ -- cgit v1.2.3