Move the thread *hook into interpreter.
Jarkko Hietaniemi [Sun, 11 May 2003 20:17:30 +0000 (20:17 +0000)]
p4raw-id: //depot/perl@19497

embedvar.h
intrpvar.h
perlapi.h
perlvars.h
sv.c

index 02016c1..c38840d 100644 (file)
 #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)
 #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)
 #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)
 #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
 #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
 #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
 #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)
 #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 */
 
 #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
 #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 */
 
index d7c4269..26b6104 100644 (file)
@@ -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()! */
index f752637..4e6bd10 100644 (file)
--- 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 */
index f9a87a9..495aa11 100644 (file)
@@ -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 (file)
--- 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;