Add PL_shutdownhook

This commit is contained in:
Leon Timmermans 2021-08-06 16:30:46 +02:00
parent 5613dc601d
commit 23d1caeec8
6 changed files with 25 additions and 0 deletions

View File

@ -2353,6 +2353,7 @@ p |void |no_bareword_filehandle \
|NN const char *fhname
Tefprv |void |noperl_die |NN const char *pat \
|...
CGTdp |void |noshutdownhook
Adp |int |nothreadhook
p |void |notify_parser_that_encoding_changed
: Used in perly.y

View File

@ -452,6 +452,7 @@
# define new_stackinfo(a,b) Perl_new_stackinfo(aTHX_ a,b)
# define new_stackinfo_flags(a,b,c) Perl_new_stackinfo_flags(aTHX_ a,b,c)
# define new_version(a) Perl_new_version(aTHX_ a)
# define noshutdownhook Perl_noshutdownhook
# define nothreadhook() Perl_nothreadhook(aTHX)
# define op_append_elem(a,b,c) Perl_op_append_elem(aTHX_ a,b,c)
# define op_append_list(a,b,c) Perl_op_append_list(aTHX_ a,b,c)

13
perl.c
View File

@ -480,6 +480,19 @@ Perl_nothreadhook(pTHX)
return 0;
}
/*
=for apidoc noshutdownhook
Stub that provides shutdown hook.
=cut
*/
void
Perl_noshutdownhook()
{
}
#ifdef DEBUG_LEAKING_SCALARS_FORK_DUMP
void
Perl_dump_sv_child(pTHX_ SV *sv)

1
perl.h
View File

@ -5350,6 +5350,7 @@ typedef int (*thrhook_proc_t) (pTHX);
typedef OP* (*PPADDR_t[]) (pTHX);
typedef bool (*destroyable_proc_t) (pTHX_ SV *sv);
typedef void (*despatch_signals_proc_t) (pTHX);
typedef void (*shutdown_proc_t)();
#if defined(__DYNAMIC__) && defined(PERL_DARWIN) && defined(PERL_CORE)
# include <crt_externs.h> /* for the env array */

View File

@ -380,6 +380,12 @@ PERLVAR(G, user_prop_mutex, perl_mutex) /* Mutex for manipulating
PL_user_defined_properties */
#endif
/* This hook is called during system termination (PERL_SYS_TERM).
* This is needed for tearing down threads::shared and probably
* not be used for anything else.
*/
PERLVARI(G, shutdownhook, shutdown_proc_t, &Perl_noshutdownhook);
/* these record the best way to perform certain IO operations while
* atomically setting FD_CLOEXEC. On the first call, a probe is done
* and the result recorded for use by subsequent calls.

3
proto.h generated
View File

@ -3155,6 +3155,9 @@ Perl_noperl_die(const char *pat, ...)
#define PERL_ARGS_ASSERT_NOPERL_DIE \
assert(pat)
PERL_CALLCONV void
Perl_noshutdownhook(void);
PERL_CALLCONV int
Perl_nothreadhook(pTHX);
#define PERL_ARGS_ASSERT_NOTHREADHOOK