Skip to content

Commit b3d6bbf

Browse files
committed
Print a spinner with in panic!
The delay also stops us chewing 100% CPU on the Neotron Desktop BIOS.
1 parent 9e0a438 commit b3d6bbf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,9 +494,13 @@ pub extern "C" fn main(api: &'static bios::Api) -> ! {
494494
#[panic_handler]
495495
fn panic(info: &core::panic::PanicInfo) -> ! {
496496
println!("PANIC!\n{:#?}", info);
497-
use core::sync::atomic::{self, Ordering};
498497
loop {
499-
atomic::compiler_fence(Ordering::SeqCst);
498+
for ch in "|/-\\".chars() {
499+
print!("\r{}", ch);
500+
if let Some(api) = unsafe { API } {
501+
(api.delay)(neotron_common_bios::Timeout::new_ms(100));
502+
}
503+
}
500504
}
501505
}
502506

0 commit comments

Comments
 (0)