24#ifndef PROTOCORE_WORKER_H
25#define PROTOCORE_WORKER_H
29#include "locus_carcerum/locus_carcerum.h"
31#if PROTOCORE_ENABLE_PREEMPT_QUEUE
51#if PROTOCORE_WORKER_COUNT == 1
169#if PROTOCORE_ENABLE_PREEMPT_QUEUE
171 PreemptQueueNs *queue;
181 void (*
const run_deferred)(uint8_t *work);
182 void (*
const running)(uint8_t *work);
183 void (*
const start)(uint8_t *work);
184 void (*
const stop)(uint8_t *work);
185 void (*
const wake)(uint8_t *work);
186 void (*
const defer)(uint8_t *work);
197#if PROTOCORE_ENABLE_PREEMPT_QUEUE
204static const WorkerNs Workers __attribute__((unused)) = {
211#if PROTOCORE_ENABLE_PREEMPT_QUEUE
#define PROTOCORE_INLINE
Linkage for a leaf primitive whose body is cheaper than the call that reaches it.
User-configurable preempting work queues + high-priority processing tasks (PROTOCORE_ENABLE_PREEMPT_Q...
One deferred call: what runs, and what it is given.
protocore_deferred_fn fn
what the worker runs
void * arg
the opaque context it is given
void(*const run_deferred)(uint8_t *work)
WorkerDeferArgs defer_args
the call handed to a worker to run in its own context
protocore_worker_pump_fn pump
what a started worker runs each time it wakes
int worker_id
the worker every call names
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
_Bool proto_bool
The truth value.
#define PROTOCORE_END_DECLS
void(* protocore_deferred_fn)(void *arg)
Deferred callback signature.
void protocore_workers_stop(uint8_t *work)
void protocore_workers_defer(uint8_t *work)
const MinimumSecurityGuard * protocore_plain_guard(void)
The plaintext guard the calling worker borrows through. Never NULL.
PROTOCORE_BEGIN_DECLS int protocore_worker_count(void)
Number of server worker tasks (PROTOCORE_WORKER_COUNT).
void protocore_workers_run_deferred(uint8_t *work)
void protocore_workers_running(uint8_t *work)
void protocore_worker_set_self(int id)
Bind the calling task/thread to worker id id (worker entry / tests).
uint8_t * protocore_worker_span(void)
The PROTOCORE_WORKER_BORROW bytes this module's state lives in.
void protocore_workers_start(uint8_t *work)
void * protocore_secure_persist(size_t n)
n persistent key-material bytes, zeroed, or NULL if the calling worker's cellblock is full.
int protocore_worker_self(void)
Worker id [0, count) of the calling task; 0 by default / single-worker.
void * protocore_plain_persist(size_t n)
n persistent plaintext bytes, zeroed, or NULL if the calling worker's cellblock is full.
const MaximumSecurityGuard * protocore_secure_guard(void)
The key-material guard the calling worker borrows through. Never NULL.
WorkersVars WorkersV
The operands and the outcome.
void(* protocore_worker_pump_fn)(int worker_id)
Pump callback run by each worker task with its worker id.
void protocore_workers_wake(uint8_t *work)
void protocore_cellblocks_bind(int worker, const MinimumSecurityGuard *plain, const MaximumSecurityGuard *secure)
Hand worker slot worker the guards it borrows through.