sched: add support for scheduling functions to be executed later
This commit is contained in:
18
sched/wait.c
18
sched/wait.c
@@ -71,3 +71,21 @@ void wakeup_one(struct waitqueue *q)
|
||||
|
||||
spin_unlock_irqrestore(&q->wq_lock, flags);
|
||||
}
|
||||
|
||||
void sleep_forever(void)
|
||||
{
|
||||
struct thread *thr = current_thread();
|
||||
struct runqueue *rq = thr->tr_rq;
|
||||
|
||||
unsigned long flags;
|
||||
rq_lock(rq, &flags);
|
||||
|
||||
rq_remove_thread(rq, thr);
|
||||
thr->tr_state = THREAD_SLEEPING;
|
||||
|
||||
rq_unlock(rq, flags);
|
||||
|
||||
while (thr->tr_state == THREAD_SLEEPING) {
|
||||
schedule(SCHED_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user