MCPcopy Create free account
hub / github.com/evilsocket/cake / hip_sigabrt_handler

Function hip_sigabrt_handler

cake-core/src/backends/rocm/mod.rs:28–37  ·  view source on GitHub ↗

SIGABRT handler: HIP runtime crashes in Monitor::tryLock during process exit because its atexit cleanup runs after threads are torn down. We catch the resulting abort and force a clean exit since all useful work is already done. Uses `exit_group` syscall directly for reliable process termination.

(_sig: libc::c_int)

Source from the content-addressed store, hash-verified

26///
27/// Uses `exit_group` syscall directly for reliable process termination.
28extern "C" fn hip_sigabrt_handler(_sig: libc::c_int) {
29 if HIP_INITIALIZED.load(Ordering::Relaxed) {
30 unsafe { libc::syscall(libc::SYS_exit_group, 0); }
31 }
32 // Not HIP-related — re-raise with default handler
33 unsafe {
34 libc::signal(libc::SIGABRT, libc::SIG_DFL);
35 libc::raise(libc::SIGABRT);
36 }
37}
38
39/// atexit handler: terminates process before HIP's broken atexit cleanup runs.
40/// Registered after HIP init, so runs before HIP's handler (LIFO order).

Callers

nothing calls this directly

Calls 1

loadMethod · 0.45

Tested by

no test coverage detected