On Tue, Jul 30, 2019 at 9:34 PM Sebastian Gniazdowski < sgniazdowski@gmail.com> wrote: > On Tue, 30 Jul 2019 at 21:24, Roman Perepelitsa > wrote: > > > > On Tue, Jul 30, 2019 at 8:53 PM Sebastian Gniazdowski > > wrote: > > > > > > On Tue, 30 Jul 2019 at 20:22, Roman Perepelitsa > > > wrote: > > > > > > > > Do you think it's possible to implement clean shutdown and reentrant > > > > initialization for a piece of code as blackbox? > > > > > > What do you mean exactly? As a blackbox - as a regular, repeatable > method? > > > > In order to implement clean shutdown for a piece of code with > > non-trivial capabilities you have to rely on its implementation > > details. You cannot implement generic clean shutdown that will work > > with any code. > > Yeah but this is solved by the unload function that I've described in > the previous post. > I think we are in agreement. If there is a public function to unload, you can call it. If there isn't, it's a missing feature that cannot be provided by anyone other than the code's author. it's not possible to safely unload code as a blackbox without knowing all of its implementation details. Both gitstatusd and p10k do provide public functions for unloading. You are welcome to call them. They guarantee that repeated load+unload won't leak resources. That is, as long as you don't unset any of their internal variables. They do leave a handful of global parameters after unloading; without them they cannot be loaded correctly again. Roman.