Function std::rt::at_exitUnstable [-] [+] [src]

pub fn at_exit<F: FnOnce() + Send + 'static>(f: F)

Enqueues a procedure to run when the runtime is cleaned up

The procedure passed to this function will be executed as part of the runtime cleanup phase. For normal rust programs, this means that it will run after all other threads have exited.

The procedure is not executed with a local Thread available to it, so primitives like logging, I/O, channels, spawning, etc, are not available. This is meant for "bare bones" usage to clean up runtime details, this is not meant as a general-purpose "let's clean everything up" function.

It is forbidden for procedures to register more at_exit handlers when they are running, and doing so will lead to a process abort.