4 ms·
Seems to me that what's "supposed to happen" is "make it so the situation can't happen". That is, either make it so that you cannot unload the library if some
by AnimalMuppet 7y ago
Seems to me that what's "supposed to happen" is "make it so the situation can't happen". That is, either make it so that you cannot unload the library if some function is registered with atexit, or else make it so that unloading the library unregisters the atexit function.
But of course, that can't happen, because you can have N function calls between the registered atexit function and the call to the library, and deciding if any calls to the library are anywhere in the graph and will be called is probably equivalent to the halting problem.
I agree that none of the possibilities are what we actually want.
- gok 7y agoBonus: what happens when the function you register is JIT'd, so there's no unregistration code path when it's unloaded?
- kazinator 7y ago> because you can have N function calls between the registered atexit function and the call to the library, I don't think that's a problem. A simple sweep through the atexit list to see if any of the pointers are into this library, to block the unload. If some atexit-registered function not in that unloaded library has a secretly stashed pointer to a function in that library, and calls it during atexit, that's a programmer problem.
- NOTTHE1 7y agoReally? That's your story and your sticking to that ?