Skip to main content

flush_sync

Function flush_sync 

Source
pub fn flush_sync()
Expand description

Synchronously drain any bytes still queued in the TX ring, via the blocking polling write. No-op if interrupt-driven TX was never enabled (nothing can be queued there).

Call this before anything that terminates or resets the guest right after printing diagnostics — crate::fault::on_fault’s Panic policy, the default panic handler, a watchdog timeout — since all of them print a final message and then call crate::port::board::reset or exit essentially immediately. Without a synchronous flush there, that message would very likely be lost: it’s sitting in the TX ring waiting for the interrupt-driven ISR to drain it, but the guest halts before that interrupt ever gets a chance to fire. Diagnostic output a human needs to actually see must not depend on an interrupt that may never come.