From: Jarkko Hietaniemi Date: Sun, 11 May 2003 20:17:30 +0000 (+0000) Subject: Move the thread *hook into interpreter. X-Git-Tag: accepted/trunk/20130322.191538~24208 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=15a5279aa74a37f0ad0b3fa3f9e566cb2d7a9d9a;p=platform%2Fupstream%2Fperl.git Move the thread *hook into interpreter. p4raw-id: //depot/perl@19497 --- diff --git a/embedvar.h b/embedvar.h index 02016c1..c38840d 100644 --- a/embedvar.h +++ b/embedvar.h @@ -296,6 +296,7 @@ #define PL_linestart (vTHX->Ilinestart) #define PL_linestr (vTHX->Ilinestr) #define PL_localpatches (vTHX->Ilocalpatches) +#define PL_lockhook (vTHX->Ilockhook) #define PL_main_cv (vTHX->Imain_cv) #define PL_main_root (vTHX->Imain_root) #define PL_main_start (vTHX->Imain_start) @@ -368,6 +369,7 @@ #define PL_savebegin (vTHX->Isavebegin) #define PL_sawampersand (vTHX->Isawampersand) #define PL_sh_path_compat (vTHX->Ish_path_compat) +#define PL_sharehook (vTHX->Isharehook) #define PL_sig_pending (vTHX->Isig_pending) #define PL_sighandlerp (vTHX->Isighandlerp) #define PL_signals (vTHX->Isignals) @@ -394,9 +396,11 @@ #define PL_sys_intern (vTHX->Isys_intern) #define PL_taint_warn (vTHX->Itaint_warn) #define PL_tainting (vTHX->Itainting) +#define PL_threadhook (vTHX->Ithreadhook) #define PL_tokenbuf (vTHX->Itokenbuf) #define PL_uid (vTHX->Iuid) #define PL_unicode (vTHX->Iunicode) +#define PL_unlockhook (vTHX->Iunlockhook) #define PL_unsafe (vTHX->Iunsafe) #define PL_utf8_alnum (vTHX->Iutf8_alnum) #define PL_utf8_alnumc (vTHX->Iutf8_alnumc) @@ -590,6 +594,7 @@ #define PL_Ilinestart PL_linestart #define PL_Ilinestr PL_linestr #define PL_Ilocalpatches PL_localpatches +#define PL_Ilockhook PL_lockhook #define PL_Imain_cv PL_main_cv #define PL_Imain_root PL_main_root #define PL_Imain_start PL_main_start @@ -662,6 +667,7 @@ #define PL_Isavebegin PL_savebegin #define PL_Isawampersand PL_sawampersand #define PL_Ish_path_compat PL_sh_path_compat +#define PL_Isharehook PL_sharehook #define PL_Isig_pending PL_sig_pending #define PL_Isighandlerp PL_sighandlerp #define PL_Isignals PL_signals @@ -688,9 +694,11 @@ #define PL_Isys_intern PL_sys_intern #define PL_Itaint_warn PL_taint_warn #define PL_Itainting PL_tainting +#define PL_Ithreadhook PL_threadhook #define PL_Itokenbuf PL_tokenbuf #define PL_Iuid PL_uid #define PL_Iunicode PL_unicode +#define PL_Iunlockhook PL_unlockhook #define PL_Iunsafe PL_unsafe #define PL_Iutf8_alnum PL_utf8_alnum #define PL_Iutf8_alnumc PL_utf8_alnumc @@ -880,7 +888,6 @@ #define PL_do_undump (PL_Vars.Gdo_undump) #define PL_dollarzero_mutex (PL_Vars.Gdollarzero_mutex) #define PL_hexdigit (PL_Vars.Ghexdigit) -#define PL_lockhook (PL_Vars.Glockhook) #define PL_malloc_mutex (PL_Vars.Gmalloc_mutex) #define PL_op_mutex (PL_Vars.Gop_mutex) #define PL_patleave (PL_Vars.Gpatleave) @@ -888,10 +895,7 @@ #define PL_runops_dbg (PL_Vars.Grunops_dbg) #define PL_runops_std (PL_Vars.Grunops_std) #define PL_sh_path (PL_Vars.Gsh_path) -#define PL_sharehook (PL_Vars.Gsharehook) #define PL_thr_key (PL_Vars.Gthr_key) -#define PL_threadhook (PL_Vars.Gthreadhook) -#define PL_unlockhook (PL_Vars.Gunlockhook) #else /* !PERL_GLOBAL_STRUCT */ @@ -901,7 +905,6 @@ #define PL_Gdo_undump PL_do_undump #define PL_Gdollarzero_mutex PL_dollarzero_mutex #define PL_Ghexdigit PL_hexdigit -#define PL_Glockhook PL_lockhook #define PL_Gmalloc_mutex PL_malloc_mutex #define PL_Gop_mutex PL_op_mutex #define PL_Gpatleave PL_patleave @@ -909,10 +912,7 @@ #define PL_Grunops_dbg PL_runops_dbg #define PL_Grunops_std PL_runops_std #define PL_Gsh_path PL_sh_path -#define PL_Gsharehook PL_sharehook #define PL_Gthr_key PL_thr_key -#define PL_Gthreadhook PL_threadhook -#define PL_Gunlockhook PL_unlockhook #endif /* PERL_GLOBAL_STRUCT */ diff --git a/intrpvar.h b/intrpvar.h index d7c4269..26b6104 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -508,6 +508,12 @@ PERLVAR(Istashcache, HV *) /* Cache to speed up S_method_common */ PERLVAR(Ireentrant_retint, int) /* Integer return value from reentrant functions */ +/* Hooks to shared SVs and locks. */ +PERLVARI(Isharehook, share_proc_t, MEMBER_TO_FPTR(Perl_sv_nosharing)) +PERLVARI(Ilockhook, share_proc_t, MEMBER_TO_FPTR(Perl_sv_nolocking)) +PERLVARI(Iunlockhook, share_proc_t, MEMBER_TO_FPTR(Perl_sv_nounlocking)) +PERLVARI(Ithreadhook, thrhook_proc_t, MEMBER_TO_FPTR(Perl_nothreadhook)) + PERLVAR(IDBassertion, SV *) /* Don't forget to add your variable also to perl_clone()! */ diff --git a/perlapi.h b/perlapi.h index f752637..4e6bd10 100644 --- a/perlapi.h +++ b/perlapi.h @@ -350,6 +350,8 @@ END_EXTERN_C #define PL_linestr (*Perl_Ilinestr_ptr(aTHX)) #undef PL_localpatches #define PL_localpatches (*Perl_Ilocalpatches_ptr(aTHX)) +#undef PL_lockhook +#define PL_lockhook (*Perl_Ilockhook_ptr(aTHX)) #undef PL_main_cv #define PL_main_cv (*Perl_Imain_cv_ptr(aTHX)) #undef PL_main_root @@ -494,6 +496,8 @@ END_EXTERN_C #define PL_sawampersand (*Perl_Isawampersand_ptr(aTHX)) #undef PL_sh_path_compat #define PL_sh_path_compat (*Perl_Ish_path_compat_ptr(aTHX)) +#undef PL_sharehook +#define PL_sharehook (*Perl_Isharehook_ptr(aTHX)) #undef PL_sig_pending #define PL_sig_pending (*Perl_Isig_pending_ptr(aTHX)) #undef PL_sighandlerp @@ -546,12 +550,16 @@ END_EXTERN_C #define PL_taint_warn (*Perl_Itaint_warn_ptr(aTHX)) #undef PL_tainting #define PL_tainting (*Perl_Itainting_ptr(aTHX)) +#undef PL_threadhook +#define PL_threadhook (*Perl_Ithreadhook_ptr(aTHX)) #undef PL_tokenbuf #define PL_tokenbuf (*Perl_Itokenbuf_ptr(aTHX)) #undef PL_uid #define PL_uid (*Perl_Iuid_ptr(aTHX)) #undef PL_unicode #define PL_unicode (*Perl_Iunicode_ptr(aTHX)) +#undef PL_unlockhook +#define PL_unlockhook (*Perl_Iunlockhook_ptr(aTHX)) #undef PL_unsafe #define PL_unsafe (*Perl_Iunsafe_ptr(aTHX)) #undef PL_utf8_alnum @@ -918,8 +926,6 @@ END_EXTERN_C #define PL_dollarzero_mutex (*Perl_Gdollarzero_mutex_ptr(NULL)) #undef PL_hexdigit #define PL_hexdigit (*Perl_Ghexdigit_ptr(NULL)) -#undef PL_lockhook -#define PL_lockhook (*Perl_Glockhook_ptr(NULL)) #undef PL_malloc_mutex #define PL_malloc_mutex (*Perl_Gmalloc_mutex_ptr(NULL)) #undef PL_op_mutex @@ -934,14 +940,8 @@ END_EXTERN_C #define PL_runops_std (*Perl_Grunops_std_ptr(NULL)) #undef PL_sh_path #define PL_sh_path (*Perl_Gsh_path_ptr(NULL)) -#undef PL_sharehook -#define PL_sharehook (*Perl_Gsharehook_ptr(NULL)) #undef PL_thr_key #define PL_thr_key (*Perl_Gthr_key_ptr(NULL)) -#undef PL_threadhook -#define PL_threadhook (*Perl_Gthreadhook_ptr(NULL)) -#undef PL_unlockhook -#define PL_unlockhook (*Perl_Gunlockhook_ptr(NULL)) #endif /* !PERL_CORE */ #endif /* MULTIPLICITY */ diff --git a/perlvars.h b/perlvars.h index f9a87a9..495aa11 100644 --- a/perlvars.h +++ b/perlvars.h @@ -52,12 +52,6 @@ PERLVAR(Gop_mutex, perl_mutex) /* Mutex for op refcounting */ PERLVARI(Grunops_std, runops_proc_t, MEMBER_TO_FPTR(Perl_runops_standard)) PERLVARI(Grunops_dbg, runops_proc_t, MEMBER_TO_FPTR(Perl_runops_debug)) -/* Hooks to shared SVs and locks. */ -PERLVARI(Gsharehook, share_proc_t, MEMBER_TO_FPTR(Perl_sv_nosharing)) -PERLVARI(Glockhook, share_proc_t, MEMBER_TO_FPTR(Perl_sv_nolocking)) -PERLVARI(Gunlockhook, share_proc_t, MEMBER_TO_FPTR(Perl_sv_nounlocking)) -PERLVARI(Gthreadhook, thrhook_proc_t, MEMBER_TO_FPTR(Perl_nothreadhook)) - /* Stores the PPID */ #ifdef THREADS_HAVE_PIDS PERLVARI(Gppid, IV, 0) diff --git a/sv.c b/sv.c index 05e999b..131450d 100644 --- a/sv.c +++ b/sv.c @@ -11217,6 +11217,12 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags, * but do it for consistency's sake. */ PL_reentrant_retint = proto_perl->Ireentrant_retint; + /* Hooks to shared SVs and locks. */ + PL_sharehook = proto_perl->Isharehook; + PL_lockhook = proto_perl->Ilockhook; + PL_unlockhook = proto_perl->Iunlockhook; + PL_threadhook = proto_perl->Ithreadhook; + /* swatch cache */ PL_last_swash_hv = Nullhv; /* reinits on demand */ PL_last_swash_klen = 0;