Skip to main content

Module keep_awake

Module keep_awake 

Source
Expand description

M-RECP.3 / AUT-264 — Display-keep-awake RAII guard.

KeepAwakeGuard holds an OS-level assertion that prevents the display from dimming / sleeping while the preview is active. On drop the assertion releases automatically (RAII). Production macOS implementation via IOPMAssertion, Windows via SetThreadExecutionState, Linux via org.freedesktop.ScreenSaver D-Bus inhibit — all deferred to a follow-up commit that needs hardware verification.

Today’s implementation: a counter-only stub so the state-machine tests verify the RAII contract on every OS. The PreviewSession::new_with_keep_awake integration lives in crates/app/src/preview.rs once the OS calls land.

Structs§

KeepAwakeGuard
RAII guard that holds the keep-awake assertion while alive.

Statics§

ACTIVE_COUNT 🔒
Process-wide active-assertion count. Real OS assertions don’t stack but our stub does so the tests can assert on RAII drop.

Functions§

active_assertions
Snapshot of active keep-awake assertions across the process. Useful for assertions in tests + for the cleanup_smoke test in M-RECP.4 (no zombie assertions after app quit).