1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//! Selects the `runtime::task` spawn/sleep/interval backend at compile time.
//!
//! The task seam (`src/runtime/task.rs`) has two mutually exclusive backends,
//! chosen here so the ~two dozen seam sites gate on one uniform condition
//! rather than repeating the target/environment predicate at each:
//!
//! * `exec_backend` — the std-thread background executor (callback pool +
//! delayed timer + scanOnce worker, `runtime::background`). This is the
//! only option on `epics_embedded_target` (RTEMS or VxWorks — no tokio
//! reactor on either), and — via `EPICS_RS_BUILD_EXEC_BACKEND=thread` — the
//! **host-selectable RTEMS execution model**: a real product mechanism for a
//! Linux (e.g. PREEMPT_RT) blocking-front-end deployment that wants the same
//! runtime-free spawn/timer backend the embedded build uses, driving async
//! record-processing completion on dedicated OS threads instead of a tokio
//! runtime.
//! * `tokio_backend` — the tokio runtime. The hosted default (variable unset
//! or `tokio`, non-embedded target).
//!
//! Exactly one of the two is set for any build.
//!
//! # Why an environment variable and not a cargo feature
//!
//! It was a feature, `rtems-exec-model`, and a feature that flips a backend is
//! not additive: `--all-features` resolved it ON, so the single invocation that is
//! supposed to mean "everything compiled" turned the reactor OFF and
//! *subtracted* every reactor-dependent test, doc example and lint from the
//! run. There was no cargo invocation that meant "host reactor plus everything
//! on", which is how a `-D warnings` failure and two broken doc examples
//! survived a full CI battery.
//!
//! An environment variable is orthogonal to feature resolution, so
//! `--all-features` means what it says and the backend is one more axis to
//! vary. The cost is that cargo does not track it for you: every build script
//! that reads it must also emit `cargo::rerun-if-env-changed`, or a changed
//! value reuses artefacts built under the old one. That line, not the read, is
//! the correctness of the arrangement — `tools/rtems-exec-gate` holds all 23
//! copies of the derivation against `CANONICAL_DERIVATION` byte for byte so no
//! copy can lose it.