summaryrefslogtreecommitdiff
path: root/lume-legacy/include/kernel/runqueue.h
blob: 14704ceb07e28dc8562f77a9a18e626090330cd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (C) 2026 Richard QIn
 */

#pragma once
#include "kernel/spinlock.h"
#include "kernel/proc_def.h"

struct RunQueue
{
    Spinlock lock;
    struct Proc *heads[N_PRIO];
    struct Proc *tails[N_PRIO];
    uint64 count;

    void init(const char *name);
    void enqueue(struct Proc *p);
    struct Proc *dequeue();
    struct Proc *steal();
};