by barrkel · 7y ago · 0 comments
On process death vs on module death. Is the function to clean up the process, or is it to clean up the module?
I think the argument for module cleanup is stronger, irrespective of the difficulty of registering code that's supposed to last longer than the calling address space. The module had nothing before it was loaded, it should leave nothing behind when it is unloaded. It's symmetrical.
The difficulty of providing an executable callback that outlives its module just seals the deal.
you could make the same argument with threads
main process vs child threads, you would expect atexit installed in the child thread to execute before the main process atexit installed functions