Changeset b50b5af2 in mainline for kernel/generic/src/synch/waitq.c


Ignore:
Timestamp:
2009-08-22T10:48:00Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
04803bf
Parents:
1ea99cc (diff), a71c158 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    r1ea99cc rb50b5af2  
    171171out:
    172172        spinlock_unlock(&threads_lock);
     173        interrupts_restore(ipl);
     174}
     175
     176/** Interrupt the first thread sleeping in the wait queue.
     177 *
     178 * Note that the caller somehow needs to know that the thread to be interrupted
     179 * is sleeping interruptibly.
     180 *
     181 * @param wq            Pointer to wait queue.
     182 */
     183void waitq_unsleep(waitq_t *wq)
     184{
     185        ipl_t ipl;
     186
     187        ipl = interrupts_disable();
     188        spinlock_lock(&wq->lock);
     189
     190        if (!list_empty(&wq->head)) {
     191                thread_t *t;
     192               
     193                t = list_get_instance(wq->head.next, thread_t, wq_link);
     194                spinlock_lock(&t->lock);
     195                ASSERT(t->sleep_interruptible);
     196                if (t->timeout_pending && timeout_unregister(&t->sleep_timeout))
     197                        t->timeout_pending = false;
     198                list_remove(&t->wq_link);
     199                t->saved_context = t->sleep_interruption_context;
     200                t->sleep_queue = NULL;
     201                spinlock_unlock(&t->lock);
     202                thread_ready(t);
     203        }
     204
     205        spinlock_unlock(&wq->lock);
    173206        interrupts_restore(ipl);
    174207}
Note: See TracChangeset for help on using the changeset viewer.