Commit 5a4802be authored by Stefan Lankes's avatar Stefan Lankes
Browse files

revise exit handling

A valid exit code means that a thread calls the system call `exit`.
In this case, we have to terminate all threads like the behaviour of
`exit`. This current version is the reason that PR
`hermitcore/libhermit-rs#160` doesn't pass all tests.
parent 92f914c1
......@@ -283,30 +283,27 @@ fn main() {
error!("CPU {} crashes! {}", tid, x);
None
}
Ok(exit_code) => exit_code,
Ok(exit_code) => {
if let Some(code) = exit_code {
#[cfg(feature = "instrument")]
rftrace_frontend::dump_full_uftrace(events, "uhyve_trace", "uhyve", true)
.expect("Saving trace failed");
std::process::exit(code);
}
exit_code
}
}
})
})
.collect();
let mut exit_code: Option<i32> = None;
for t in threads {
let exit_code_tid = t.join().unwrap();
if exit_code_tid.is_some() {
if exit_code.is_some() {
debug!("Found multiple exit code. Taking the laste one");
}
exit_code = exit_code_tid;
}
t.join().unwrap();
}
#[cfg(feature = "instrument")]
rftrace_frontend::dump_full_uftrace(events, "uhyve_trace", "uhyve", true)
.expect("Saving trace failed");
match exit_code {
Some(a) => std::process::exit(a),
None => std::process::exit(0),
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment