perl5
perl5 copied to clipboard
Add PL_shutdownhook
This is a proposed solution to #19022
This adds a hook that is run early in PERL_SYS_TERM to terminate global resources, and uses it to destroy the shared interpreter in threads::shared
On Fri, Aug 06, 2021 at 07:57:06AM -0700, Leon Timmermans wrote:
This is a proposed solution to #19022
This adds a hook that is run early in
PERL_SYS_TERMto terminate global resources, and uses it to destroy the shared interpreter inthreads::sharedYou can view, comment on, or merge this pull request online at:
Any particular reason PL_shutdownhook is manually declared in perl.h rather than being in perlvars.h like other global vars?
-- Never do today what you can put off till tomorrow.
Any particular reason PL_shutdownhook is manually declared in perl.h rather than being in perlvars.h like other global vars?
I didn't know about that, but that does seem like a better idea. I copied it from something else that also wasn't in perlvars.h (but I forgot what)
Any particular reason PL_shutdownhook is manually declared in perl.h rather than being in perlvars.h like other global vars?
Fixed that.
Aside from my comment about reflowing a macro, this LGTM
could you please document PL_shutdownhook?
So, are we just waiting for @Leont to document this before it is ready to merge?
* leont is not sure where/how to document PL_shutdownhook, given that
none of the other similar hooks are documented.
I'm not so worried about where, more about adding another undocumented public hook.
Things to document:
- when is the hook called? Do I need to chain to the old hook?
- what do I need to lock to set it? (though a simple API to set (or add/remove a given function pointer) it might be better, since hooks have led to some bugs in the past)
@leont, this looks close to being ready
@Leont, this looks close to being ready
@LeonT, can we get an update on the status of this pull request?
@Leont, can we get an update on the status of this pull request?
I'm adapting it to tony's suggestion (simple API to set it), will update it soon
@leont last message in this PR is that you were adapting it to feedback. Do you still want to keep this PR? (It seems reasonable to me in principal).
Do you still want to keep this PR? (It seems reasonable to me in principal).
Yeah, it's a problem that needs a solution. I'll try to pick it up again soon.
@Leont I'm happy to get it rebased for you considering you seem busy of late.
I'm happy to get it rebased for you considering you seem busy of late.
It needs much more than a rebase, otherwise this would have been merged already. I'll try to finish this soon.