All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m12s
33 lines
719 B
C
33 lines
719 B
C
#include <libk/list.h>
|
|
#include <mm/liballoc.h>
|
|
#include <proc/reschedule.h>
|
|
#include <sync/spin_lock.h>
|
|
#include <sys/smp.h>
|
|
|
|
void reschedule_list_append (struct reschedule_ctx* rctx, struct cpu* cpu) {
|
|
spin_lock (&rctx->lock);
|
|
|
|
struct list_node_link *node, *tmp;
|
|
list_foreach (rctx->entries, node, tmp) {
|
|
struct reschedule_entry* entry = list_entry (node, struct reschedule_entry, link);
|
|
|
|
if (entry->cpu == cpu) {
|
|
spin_unlock (&rctx->lock);
|
|
return;
|
|
}
|
|
}
|
|
|
|
struct reschedule_entry* entry = malloc (sizeof (*entry));
|
|
|
|
if (entry == NULL) {
|
|
spin_unlock (&rctx->lock);
|
|
return;
|
|
}
|
|
|
|
entry->cpu = cpu;
|
|
|
|
list_append (rctx->entries, &entry->link);
|
|
|
|
spin_unlock (&rctx->lock);
|
|
}
|