Skip to main content

exit_now

Function exit_now 

Source
pub fn exit_now(code: i32) -> !
Expand description

Ends the process now with code: _exit, without the atexit handlers, destructors and stream flushes of std::process::exit, any of which can allocate or wait on a lock held by a thread that will never release it. Every exit taken while another thread may still run goes through it: exit runs the libraries’ destructors under that thread (libxml2’s .fini_array calls xmlCleanupParser, freeing the catalog, encoding aliases, dict mutexes and global-state key a running render reads: a render worker’s SIGSEGV with ip == fault address in freed heap, on Nasser’s 2,400-problem slice under concurrent load, issue #777, not reproduced). What must land is written first, unbuffered: the stderr line (write_stderr_unlocked), the log mirror (an unbuffered write(2)), a pre-exit hook’s file. Only a partial line still in stdout’s line buffer is lost.