G3.1: dedicated bridge heartbeat — watchdog liveness independent of audio loop

This commit is contained in:
2026-08-16 10:04:16 +07:00
parent b59e416566
commit 30fa98a441
6 changed files with 186 additions and 31 deletions
+9 -1
View File
@@ -63,6 +63,10 @@ pub struct SharedAudioBufferIPC {
// Append-only field — offsets of control_queue (2836) and
// control_queue_count (11156) are unchanged.
pub attach_in_flight: u32,
// G3.1: dedicated heartbeat — incremented ~10Hz by a bridge thread
// independent of the audio loop. Watchdog liveness keys on this.
// Append-only field: offsets above are unchanged.
pub heartbeat: u32,
}
pub struct Shm {
@@ -166,6 +170,10 @@ impl Shm {
pub fn attach_in_flight(&self) -> bool {
self.ipc().attach_in_flight != 0
}
pub fn heartbeat(&self) -> u32 {
self.ipc().heartbeat
}
}
impl Drop for Shm {
@@ -188,6 +196,6 @@ mod tests {
// native_bridge/tests/shm_selfcheck.cpp asserts the same sizes.
assert_eq!(std::mem::size_of::<MidiEventIPC>(), 12);
assert_eq!(std::mem::size_of::<ControlEventIPC>(), 1040);
assert_eq!(std::mem::size_of::<SharedAudioBufferIPC>(), 11164);
assert_eq!(std::mem::size_of::<SharedAudioBufferIPC>(), 11168);
}
}