Closed CertainLach closed 2 years ago
Does libc::_exit
(instead of std::process::exit
) work for your use-case?
libc::exit
still causes thread local destruction, thus slowing down shutdown
Note libc has 2 functions: exit
and _exit
. What I suggested is _exit
with an underscore prefix.
Regarding on the API. How do you think about:
ObjectSpace::leak(&mut self)
. It re-initializes its linked list. The name leak
is shorter, more explicit and seems to be more generic (does not couple with Drop
).with_thread_object_space(f: impl FnOnce(&mut ObjectSpace))
. This allows one to call the leak
API. In your case, you can call it before exit
(if you don't want to use _exit
).I love idea of leak
method, it definitely looks more clear than current collect_on_drop
field approach
While this toggle isn't useful in general (because you can always call
forget(space)
), it is useful in thread-local case, because destructors for TLS entries are ran, and this isn't needed in case of CLI apps, where it delays shutdown