sched: add support for scheduling functions to be executed later

This commit is contained in:
2023-06-14 17:35:10 +01:00
parent cdb9fef36c
commit 4a1c6cae69
7 changed files with 217 additions and 1 deletions

View File

@@ -61,3 +61,22 @@ struct runqueue *cpu_rq(unsigned int cpu)
return rq;
}
void rq_remove_thread(struct runqueue *rq, struct thread *thr)
{
int prio = thread_priority(thr);
if (prio < 0 || prio > PRIO_MAX) {
return;
}
struct queue *q = &rq->rq_queues[prio];
queue_delete(q, &thr->tr_rqentry);
if (rq->rq_nthreads > 0) {
rq->rq_nthreads--;
}
if (queue_empty(q)) {
rq->rq_readybits &= ~PRIO_MASK(prio);
}
}