From 4a77bedabf6731896b8a132442eb4d7c4ce6a942 Mon Sep 17 00:00:00 2001 From: jhb Date: Tue, 4 Jun 2002 22:36:24 +0000 Subject: Replace thread_runnable() with thread_running() as the latter is more accurate. Suggested by: julian --- sys/kern/kern_mutex.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'sys/kern/kern_mutex.c') diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index d0fc8c9..08bca8d 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -70,7 +70,8 @@ #define mtx_owner(m) (mtx_unowned((m)) ? NULL \ : (struct thread *)((m)->mtx_lock & MTX_FLAGMASK)) -#define thread_runnable(td) \ +/* XXXKSE This test will change. */ +#define thread_running(td) \ ((td)->td_kse != NULL && (td)->td_kse->ke_oncpu != NOCPU) /* @@ -131,8 +132,7 @@ propagate_priority(struct thread *td) /* * If lock holder is actually running, just bump priority. */ - /* XXXKSE this test is not sufficient */ - if (thread_runnable(td)) { + if (thread_running(td)) { MPASS(td->td_proc->p_stat == SRUN || td->td_proc->p_stat == SZOMB || td->td_proc->p_stat == SSTOP); @@ -534,10 +534,9 @@ _mtx_lock_sleep(struct mtx *m, int opts, const char *file, int line) * CPU, spin instead of blocking. */ owner = (struct thread *)(v & MTX_FLAGMASK); - if (m != &Giant && thread_runnable(owner)) { + if (m != &Giant && thread_running(owner)) { mtx_unlock_spin(&sched_lock); - while (mtx_owner(m) == owner && - thread_runnable(owner)) { + while (mtx_owner(m) == owner && thread_running(owner)) { #ifdef __i386__ ia32_pause(); #endif -- cgit v1.1