Skip to content

DPCs

include/thread/dpc.h View source View on GitHub
struct dpc {
    dpc_func_t              func;
    void                    *ctx;
    _Atomic (struct dpc *)  next;
    _Atomic (bool)          enqueued;
};
struct dpc_queue {
    _Atomic (struct dpc *)  head;
    _Atomic size_t          count;
};
struct dpc_cpu {
    _Atomic (bool)    ipi_queued;
    struct dpc_queue  queues[DPC_EVENT_MAX];
};
enum dpc_event {
    DPC_NONE,
    DPC_CPU_IDLE,
    DPC_CPU_WOKE,
    DPC_EVENT_MAX,
};
typedef void (*dpc_func_t)(struct dpc * *, void * ctx);
void dpc_run_local(void);
struct dpc * dpc_create(dpc_func_t fn, void *ctx);
struct dpc * dpc_init(struct dpc *d, dpc_func_t fn, void *ctx);
void dpc_init_percpu(void);
bool dpc_enqueue_local(struct dpc *d, enum dpc_event e);
bool dpc_enqueue_on_cpu(size_t cpu, struct dpc *d, enum dpc_event e);