24#ifndef PROTOCORE_WORKER_H
25#define PROTOCORE_WORKER_H
41#if PC_WORKER_COUNT == 1
User-facing configuration for ProtoCore.
void pc_worker_run_deferred(int worker_id)
Drain and run worker worker_id's deferred callbacks (called by the worker).
void pc_worker_wake(int worker_id)
Wake worker worker_id so it services a freshly-queued event now.
void(* pc_worker_pump_fn)(int worker_id)
Pump callback run by each worker task with its worker id.
void pc_workers_start(pc_worker_pump_fn pump)
Spawn the worker task(s) and start them running pump. No-op on host.
bool pc_workers_running(void)
True while worker task(s) are running (always false on host).
void pc_worker_set_self(int id)
Bind the calling task/thread to worker id id (worker entry / tests).
int pc_worker_count(void)
Number of server worker tasks (PC_WORKER_COUNT).
bool pc_defer(int worker_id, pc_deferred_fn fn, void *arg)
Run fn(arg) on worker worker_id. Returns false if the queue is full.
void pc_workers_stop(void)
Signal the worker task(s) to exit and wait briefly for them. No-op on host.
int pc_worker_self(void)
Worker id [0, count) of the calling task; 0 by default / single-worker.
void(* pc_deferred_fn)(void *arg)
Deferred callback signature.