libxtc 0.4.0
Async concurrency for C: Tokio + Seastar + BEAM, in one library
Loading...
Searching...
No Matches
proc_int.h
1/*-
2 * Copyright (c) 2026, The XTC Project
3 * Use of this source code is governed by the ISC License.
4 *
5 * src/inc/proc_int.h
6 * Internal process primitives that are not part of the consumer
7 * API. Split out of xtc_proc.h so no __-prefixed symbol leaks into
8 * an installed public header.
9 *
10 * (The recovery-frame __xtc_recovery_* / __xtc_proc_recovery_slot
11 * decls stay in xtc_proc.h: the PUBLIC macro xtc_proc_recovery_arm()
12 * expands to them, so they must be visible in the consumer's TU.
13 * These context save/restore helpers are called only from within
14 * the library, so they belong here.)
15 */
16
17#ifndef XTC_PROC_INT_H
18#define XTC_PROC_INT_H
19
20/*
21 * Save / restore the current-proc context across a yield done by a
22 * lower-level primitive (e.g. xtc_amutex parking the fiber), so the
23 * proc still sees itself on resume. Opaque to the caller.
24 */
25void *__xtc_proc_ctx_save(void);
26void __xtc_proc_ctx_restore(void *ctx);
27
28/*
29 * A3 async causal trace hook: record one suspend/resume boundary on the
30 * CALLING proc's per-fiber ring. `kind` is an enum xtc_causal_kind and
31 * `site` a static string label (e.g. __func__). A no-op fast path (one
32 * relaxed load + branch) when the causal trace is disabled or off a
33 * proc, so a default build writes nothing on the park/resume path.
34 * Single-writer / core-private: called only on the proc's own fiber.
35 */
36void __xtc_trace_causal(int kind, const char *site);
37
38#endif /* XTC_PROC_INT_H */