version 1.12.2.1, 2007/10/26 15:48:28 |
version 1.12.2.2, 2007/11/06 19:25:26 |
Line 55 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 55 __KERNEL_RCSID(0, "$NetBSD$"); |
|
#include <sys/sleepq.h> |
#include <sys/sleepq.h> |
|
|
static void cv_unsleep(lwp_t *); |
static void cv_unsleep(lwp_t *); |
static void cv_changepri(lwp_t *, pri_t); |
|
|
|
static syncobj_t cv_syncobj = { |
static syncobj_t cv_syncobj = { |
SOBJ_SLEEPQ_SORTED, |
SOBJ_SLEEPQ_SORTED, |
cv_unsleep, |
cv_unsleep, |
cv_changepri, |
sleepq_changepri, |
sleepq_lendpri, |
sleepq_lendpri, |
syncobj_noowner, |
syncobj_noowner, |
}; |
}; |
Line 110 cv_enter(kcondvar_t *cv, kmutex_t *mtx, |
|
Line 109 cv_enter(kcondvar_t *cv, kmutex_t *mtx, |
|
sleepq_t *sq; |
sleepq_t *sq; |
|
|
KASSERT(cv->cv_wmesg != deadcv && cv->cv_wmesg != NULL); |
KASSERT(cv->cv_wmesg != deadcv && cv->cv_wmesg != NULL); |
KASSERT((l->l_flag & LW_INTR) == 0 || panicstr != NULL); |
KASSERT((l->l_pflag & LP_INTR) == 0 || panicstr != NULL); |
|
|
l->l_cv_signalled = 0; |
l->l_cv_signalled = 0; |
|
l->l_kpriority = true; |
sq = sleeptab_lookup(&sleeptab, cv); |
sq = sleeptab_lookup(&sleeptab, cv); |
cv->cv_waiters++; |
cv->cv_waiters++; |
sleepq_enter(sq, l); |
sleepq_enter(sq, l); |
sleepq_enqueue(sq, sched_kpri(l), cv, cv->cv_wmesg, &cv_syncobj); |
sleepq_enqueue(sq, cv, cv->cv_wmesg, &cv_syncobj); |
mutex_exit(mtx); |
mutex_exit(mtx); |
|
|
return sq; |
return sq; |
Line 169 cv_unsleep(lwp_t *l) |
|
Line 169 cv_unsleep(lwp_t *l) |
|
} |
} |
|
|
/* |
/* |
* cv_changepri: |
|
* |
|
* Adjust the real (user) priority of an LWP blocked on a CV. |
|
*/ |
|
static void |
|
cv_changepri(lwp_t *l, pri_t pri) |
|
{ |
|
sleepq_t *sq = l->l_sleepq; |
|
pri_t opri; |
|
|
|
KASSERT(lwp_locked(l, sq->sq_mutex)); |
|
|
|
opri = lwp_eprio(l); |
|
l->l_usrpri = pri; |
|
l->l_priority = sched_kpri(l); |
|
|
|
if (lwp_eprio(l) != opri) { |
|
TAILQ_REMOVE(&sq->sq_queue, l, l_sleepchain); |
|
sleepq_insert(sq, l, l->l_syncobj); |
|
} |
|
} |
|
|
|
/* |
|
* cv_wait: |
* cv_wait: |
* |
* |
* Wait non-interruptably on a condition variable until awoken. |
* Wait non-interruptably on a condition variable until awoken. |