Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/synch/waitq.c

    rdf58e44 rc0699467  
    4545
    4646#include <synch/waitq.h>
    47 #include <synch/synch.h>
    4847#include <synch/spinlock.h>
    4948#include <proc/thread.h>
     
    6968{
    7069        irq_spinlock_initialize(&wq->lock, "wq.lock");
    71         list_initialize(&wq->head);
     70        list_initialize(&wq->sleepers);
    7271        wq->missed_wakeups = 0;
    7372}
     
    196195        irq_spinlock_lock(&wq->lock, true);
    197196       
    198         if (!list_empty(&wq->head)) {
    199                 thread_t *thread = list_get_instance(wq->head.next, thread_t, wq_link);
     197        if (!list_empty(&wq->sleepers)) {
     198                thread_t *thread = list_get_instance(list_first(&wq->sleepers),
     199                    thread_t, wq_link);
    200200               
    201201                irq_spinlock_lock(&thread->lock, false);
     
    407407        }
    408408       
    409         list_append(&THREAD->wq_link, &wq->head);
     409        list_append(&THREAD->wq_link, &wq->sleepers);
    410410       
    411411        /*
     
    464464       
    465465loop:
    466         if (list_empty(&wq->head)) {
     466        if (list_empty(&wq->sleepers)) {
    467467                wq->missed_wakeups++;
    468468                if ((count) && (mode == WAKEUP_ALL))
     
    473473       
    474474        count++;
    475         thread_t *thread = list_get_instance(wq->head.next, thread_t, wq_link);
     475        thread_t *thread = list_get_instance(list_first(&wq->sleepers),
     476            thread_t, wq_link);
    476477       
    477478        /*
Note: See TracChangeset for help on using the changeset viewer.