|
#[panic_handler] |
|
fn panic(info: &PanicInfo) -> ! { |
|
error!("{}", info); |
|
axhal::power::system_off() |
|
} |
ArceOS just powers off when a spanwed thread panics:
// axstd = { workspace = true, features = ["multitask"] }
#![no_std]
#![no_main]
use axstd::{println, thread};
#[unsafe(no_mangle)]
fn main() {
_ = thread::spawn(|| panic!("thread spawned")).join();
println!("main thread ends"); // This never runs.
}
[ 0.014810 0:4 axruntime::lang_items:5] panicked at examples/helloworld/src/main.rs:8:26:
thread spawned
The panic shouldn't terminate main thread in ArceOS.
This playground link shows how libstd API behaves.
arceos/modules/axruntime/src/lang_items.rs
Lines 3 to 7 in bcc354a
ArceOS just powers off when a spanwed thread panics:
The panic shouldn't terminate main thread in ArceOS.
This playground link shows how libstd API behaves.