pub fn cleanup_tempfiles_signal_safe()
Expand description
Remove all tempfiles still registered on our global registry, and leak their data to be signal-safe. This happens on a best-effort basis with all errors being ignored.
§Safety
Note that Mutexes of any kind are not allowed, and so aren’t allocation or deallocation of memory.
We are using lock-free datastructures and sprinkle in std::mem::forget
to avoid deallocating.
Most importantly, we use try_lock()
which uses an atomic int only without blocking, making our register method safe to use,
at the expense of possibly missing a lock file if another thread wants to obtain it or put it back
(i.e. mutates the registry shard).