Subversion Repositories HelenOS

Compare Revisions

Regard whitespace Rev 2309 → Rev 2310

/trunk/kernel/generic/src/synch/waitq.c
384,10 → 384,9
* timeout.
*
* @param wq Pointer to wait queue.
* @param all If this is non-zero, all sleeping threads will be woken up and
* missed count will be zeroed.
* @param mode Wakeup mode.
*/
void waitq_wakeup(waitq_t *wq, bool all)
void waitq_wakeup(waitq_t *wq, wakeup_mode_t mode)
{
ipl_t ipl;
 
394,7 → 393,7
ipl = interrupts_disable();
spinlock_lock(&wq->lock);
 
_waitq_wakeup_unsafe(wq, all);
_waitq_wakeup_unsafe(wq, mode);
 
spinlock_unlock(&wq->lock);
interrupts_restore(ipl);
406,21 → 405,26
* assumes wq->lock is already locked and interrupts are already disabled.
*
* @param wq Pointer to wait queue.
* @param all If this is non-zero, all sleeping threads will be woken up and
* missed count will be zeroed.
* @param mode If mode is WAKEUP_FIRST, then the longest waiting thread,
* if any, is woken up. If mode is WAKEUP_ALL, then all
* waiting threads, if any, are woken up. If there are no
* waiting threads to be woken up, the missed wakeup is
* recorded in the wait queue.
*/
void _waitq_wakeup_unsafe(waitq_t *wq, bool all)
void _waitq_wakeup_unsafe(waitq_t *wq, wakeup_mode_t mode)
{
thread_t *t;
count_t count = 0;
 
loop:
if (list_empty(&wq->head)) {
wq->missed_wakeups++;
if (all)
wq->missed_wakeups = 0;
if (count && mode == WAKEUP_ALL)
wq->missed_wakeups--;
return;
}
 
count++;
t = list_get_instance(wq->head.next, thread_t, wq_link);
/*
449,7 → 453,7
 
thread_ready(t);
 
if (all)
if (mode == WAKEUP_ALL)
goto loop;
}