Skip to content

Commit

Permalink
Add PL_shutdownhook
Browse files Browse the repository at this point in the history
  • Loading branch information
Leont committed Sep 30, 2024
1 parent 5613dc6 commit 23d1cae
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions embed.fnc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions embed.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 13 additions & 0 deletions perl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions perl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
6 changes: 6 additions & 0 deletions perlvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions proto.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 23d1cae

Please sign in to comment.