|
wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
|
Thread-based worker fan-out over the single-process wired_srvrun_serve_env: one control thread spawns N worker threads sharing the process's address space (unlike srvworkers' fork fan-out), each running its own wired_srvrun_env instance. More...
#include "app/http3/server/srvboot/srvboot.h"#include "app/http3/server/srvrun/srvrun.h"#include "app/http3/server/srvxdp/srvxdp.h"Go to the source code of this file.
Data Structures | |
| struct | wired_srvthreads_opt |
| Fan-out policy: per-worker CPU pinning, optional control-thread pinning, the srvrun knobs copied to every worker, and an optional shared AF_XDP config selecting multi-queue mode. More... | |
Macros | |
| #define | WIRED_SRVTHREADS_MAX 16u |
| Max worker threads this domain supports (fixed-size cores[] table). | |
Functions | |
| int | wired_srvthreads_run (u16 port, wired_srvboot_id *id, wired_srvrun_handler h, wired_srvrun_obs obs, const wired_srvthreads_opt *opt) |
| Run N worker threads serving port/h until a graceful shutdown is requested (SIGTERM, or SIGHUP-driven cert reload paths configured via id), matching wired_srvworkers_run's contract but over threads instead of processes: shared address space, one shared AF_XDP BPF filter in XDP mode instead of N independent ones. | |
| int | wired_srvthreads_parse_cores (const char *s, wired_srvthreads_opt *opt) |
| Parse a comma-separated core list ("2,3,4,5") into opt->cores[] and opt->n_cores, e.g. | |
Thread-based worker fan-out over the single-process wired_srvrun_serve_env: one control thread spawns N worker threads sharing the process's address space (unlike srvworkers' fork fan-out), each running its own wired_srvrun_env instance.
The control thread blocks on a timed futex wait for the shared shutdown word (wired_srvrun_shutdown_word), then joins every worker before releasing shared resources (the BPF objects, the mmap'd env storage).
Lifecycle: the control thread blocks SIGTERM/SIGHUP, spawns all N workers (which inherit the mask), unblocks and installs the handlers, waits for shutdown, then joins every worker and cleans up. A signal arriving during the blocked window is delivered, pending, once unblocked.
| int wired_srvthreads_parse_cores | ( | const char * | s, |
| wired_srvthreads_opt * | opt ) |
Parse a comma-separated core list ("2,3,4,5") into opt->cores[] and opt->n_cores, e.g.
for a –cores CLI flag (example servers each reimplemented this parser separately; this is the shared version).
The empty string is rejected rather than accepted as "0 cores": an empty –cores value is always a caller mistake (the thread-fan-out driver is only selected when –cores is given at all), so treating it as malformed surfaces the mistake instead of silently running zero workers. The same reasoning rejects a leading/trailing/doubled comma: an empty field is not a valid core number, so "2,3," and ",2,3" are malformed rather than silently ignoring the empty field.
| s | NUL-terminated comma-separated list of non-negative base-10 core numbers, e.g. "2,3,4,5" |
| opt | destination; cores[]/n_cores are written on success, left untouched on failure |
| int wired_srvthreads_run | ( | u16 | port, |
| wired_srvboot_id * | id, | ||
| wired_srvrun_handler | h, | ||
| wired_srvrun_obs | obs, | ||
| const wired_srvthreads_opt * | opt ) |
Run N worker threads serving port/h until a graceful shutdown is requested (SIGTERM, or SIGHUP-driven cert reload paths configured via id), matching wired_srvworkers_run's contract but over threads instead of processes: shared address space, one shared AF_XDP BPF filter in XDP mode instead of N independent ones.
| port | UDP port every worker serves |
| id | the fixed server identity; each worker gets its own copy so a SIGHUP reload (handled by wired_srvrun_serve_env internally) never races across workers |
| h | the application's request responder, passed through unchanged |
| obs | optional qlog/keylog/cert-reload settings, passed through |
| opt | worker CPU pinning, control pinning, srvrun knobs, and optional AF_XDP config |