From eec39c5f50fb1b4e2025025773f77293f3466492 Mon Sep 17 00:00:00 2001 From: Flávio Cruz Date: Fri, 28 Aug 2015 01:19:32 +0200 Subject: Add a thread_no_continuation definition to replace the use of the NULL pointer. * kern/sched_prim.h (thread_no_continuation): New macro. * kern/machine.c (processor_assign, processor_doaction): Use thread_no_continuation instead of 0. * kern/profile.c (send_last_sample_buf): Likewise * kern/sched_prim.c (thread_sleep, thread_invoke, thread_dispatch): Likewise. * kern/task.c (task_terminate, task_assign): Likewise. * kern/thread.c (thread_suspend): Likewise. * kern/thread.h (struct thread): Change type of swap_func field to continuation_t. --- kern/sched_prim.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'kern/sched_prim.c') diff --git a/kern/sched_prim.c b/kern/sched_prim.c index e8f260e..580ca43 100644 --- a/kern/sched_prim.c +++ b/kern/sched_prim.c @@ -454,7 +454,7 @@ void thread_sleep( { assert_wait(event, interruptible); /* assert event */ simple_unlock(lock); /* release the lock */ - thread_block((void (*)()) 0); /* block ourselves */ + thread_block(thread_no_continuation); /* block ourselves */ } /* @@ -617,7 +617,7 @@ boolean_t thread_invoke( thread_unlock(new_thread); thread_wakeup(TH_EV_STATE(new_thread)); - if (continuation != (void (*)()) 0) { + if (continuation != thread_no_continuation) { (void) spl0(); call_continuation(continuation); /*NOTREACHED*/ @@ -630,7 +630,7 @@ boolean_t thread_invoke( */ thread_lock(new_thread); if ((old_thread->stack_privilege != current_stack()) && - (continuation != (void (*)()) 0)) + (continuation != thread_no_continuation)) { switch (new_thread->state & TH_SWAP_STATE) { case TH_SWAPPED: @@ -915,7 +915,7 @@ void thread_dispatch( thread_lock(thread); - if (thread->swap_func != (void (*)()) 0) { + if (thread->swap_func != thread_no_continuation) { assert((thread->state & TH_SWAP_STATE) == 0); thread->state |= TH_SWAPPED; stack_free(thread); -- cgit v1.2.3