Skip to content

Commit 23d1cae

Browse files
committed
Add PL_shutdownhook
1 parent 5613dc6 commit 23d1cae

File tree

6 files changed

+25
-0
lines changed

6 files changed

+25
-0
lines changed

embed.fnc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2353,6 +2353,7 @@ p |void |no_bareword_filehandle \
23532353
|NN const char *fhname
23542354
Tefprv |void |noperl_die |NN const char *pat \
23552355
|...
2356+
CGTdp |void |noshutdownhook
23562357
Adp |int |nothreadhook
23572358
p |void |notify_parser_that_encoding_changed
23582359
: Used in perly.y

embed.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@
452452
# define new_stackinfo(a,b) Perl_new_stackinfo(aTHX_ a,b)
453453
# define new_stackinfo_flags(a,b,c) Perl_new_stackinfo_flags(aTHX_ a,b,c)
454454
# define new_version(a) Perl_new_version(aTHX_ a)
455+
# define noshutdownhook Perl_noshutdownhook
455456
# define nothreadhook() Perl_nothreadhook(aTHX)
456457
# define op_append_elem(a,b,c) Perl_op_append_elem(aTHX_ a,b,c)
457458
# define op_append_list(a,b,c) Perl_op_append_list(aTHX_ a,b,c)

perl.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,19 @@ Perl_nothreadhook(pTHX)
480480
return 0;
481481
}
482482

483+
/*
484+
=for apidoc noshutdownhook
485+
486+
Stub that provides shutdown hook.
487+
488+
=cut
489+
*/
490+
491+
void
492+
Perl_noshutdownhook()
493+
{
494+
}
495+
483496
#ifdef DEBUG_LEAKING_SCALARS_FORK_DUMP
484497
void
485498
Perl_dump_sv_child(pTHX_ SV *sv)

perl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5350,6 +5350,7 @@ typedef int (*thrhook_proc_t) (pTHX);
53505350
typedef OP* (*PPADDR_t[]) (pTHX);
53515351
typedef bool (*destroyable_proc_t) (pTHX_ SV *sv);
53525352
typedef void (*despatch_signals_proc_t) (pTHX);
5353+
typedef void (*shutdown_proc_t)();
53535354

53545355
#if defined(__DYNAMIC__) && defined(PERL_DARWIN) && defined(PERL_CORE)
53555356
# include <crt_externs.h> /* for the env array */

perlvars.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,12 @@ PERLVAR(G, user_prop_mutex, perl_mutex) /* Mutex for manipulating
380380
PL_user_defined_properties */
381381
#endif
382382

383+
/* This hook is called during system termination (PERL_SYS_TERM).
384+
* This is needed for tearing down threads::shared and probably
385+
* not be used for anything else.
386+
*/
387+
PERLVARI(G, shutdownhook, shutdown_proc_t, &Perl_noshutdownhook);
388+
383389
/* these record the best way to perform certain IO operations while
384390
* atomically setting FD_CLOEXEC. On the first call, a probe is done
385391
* and the result recorded for use by subsequent calls.

proto.h

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)