summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>1998-12-01 11:08:16 +0000
committerJarkko Hietaniemi <jhi@iki.fi>1998-12-01 11:08:16 +0000
commit0fbecbbf53e77b8d40c396f3fae3f94dd3efd35d (patch)
treeafc655e6b661d80a249fda0bbb8c2850231870d9 /util.c
parentc7404c214c8382be08fc3c8ba7390a940642c871 (diff)
parentdb4a4bfef3d0670c19c876489f6c14478d1740b8 (diff)
downloadperl-0fbecbbf53e77b8d40c396f3fae3f94dd3efd35d.tar.gz
Integrate from _54 mainperl modulo the NetBSD ifdef in util.c.
p4raw-id: //depot/cfgperl@2428
Diffstat (limited to 'util.c')
-rw-r--r--util.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/util.c b/util.c
index 58532a0903..3be6a91243 100644
--- a/util.c
+++ b/util.c
@@ -15,7 +15,6 @@
#include "EXTERN.h"
#include "perl.h"
-/* XXX Configure test needed */
#if !defined(NSIG) || defined(M_UNIX) || defined(M_XENIX)
#include <signal.h>
#endif
@@ -2838,11 +2837,6 @@ new_struct_thread(struct perl_thread *t)
thr->flags = THRf_R_JOINABLE;
MUTEX_INIT(&thr->mutex);
- PL_curcop = t->Tcurcop; /* XXX As good a guess as any? */
- PL_defstash = t->Tdefstash; /* XXX maybe these should */
- PL_curstash = t->Tcurstash; /* always be set to main? */
-
-
/* top_env needs to be non-zero. It points to an area
in which longjmp() stuff is stored, as C callstack
info there at least is thread specific this has to
@@ -2859,6 +2853,25 @@ new_struct_thread(struct perl_thread *t)
PL_in_eval = FALSE;
PL_restartop = 0;
+ PL_statname = NEWSV(66,0);
+ PL_maxscream = -1;
+ PL_regcompp = FUNC_NAME_TO_PTR(pregcomp);
+ PL_regexecp = FUNC_NAME_TO_PTR(regexec_flags);
+ PL_regindent = 0;
+ PL_reginterp_cnt = 0;
+ PL_lastscream = Nullsv;
+ PL_screamfirst = 0;
+ PL_screamnext = 0;
+ PL_reg_start_tmp = 0;
+ PL_reg_start_tmpl = 0;
+
+ /* parent thread's data needs to be locked while we make copy */
+ MUTEX_LOCK(&t->mutex);
+
+ PL_curcop = t->Tcurcop; /* XXX As good a guess as any? */
+ PL_defstash = t->Tdefstash; /* XXX maybe these should */
+ PL_curstash = t->Tcurstash; /* always be set to main? */
+
PL_tainted = t->Ttainted;
PL_curpm = t->Tcurpm; /* XXX No PMOP ref count */
PL_nrs = newSVsv(t->Tnrs);
@@ -2872,18 +2885,6 @@ new_struct_thread(struct perl_thread *t)
PL_bodytarget = newSVsv(t->Tbodytarget);
PL_toptarget = newSVsv(t->Ttoptarget);
- PL_statname = NEWSV(66,0);
- PL_maxscream = -1;
- PL_regcompp = FUNC_NAME_TO_PTR(pregcomp);
- PL_regexecp = FUNC_NAME_TO_PTR(regexec_flags);
- PL_regindent = 0;
- PL_reginterp_cnt = 0;
- PL_lastscream = Nullsv;
- PL_screamfirst = 0;
- PL_screamnext = 0;
- PL_reg_start_tmp = 0;
- PL_reg_start_tmpl = 0;
-
/* Initialise all per-thread SVs that the template thread used */
svp = AvARRAY(t->threadsv);
for (i = 0; i <= AvFILLp(t->threadsv); i++, svp++) {
@@ -2906,6 +2907,9 @@ new_struct_thread(struct perl_thread *t)
thr->next->prev = thr;
MUTEX_UNLOCK(&PL_threads_mutex);
+ /* done copying parent's state */
+ MUTEX_UNLOCK(&t->mutex);
+
#ifdef HAVE_THREAD_INTERN
init_thread_intern(thr);
#endif /* HAVE_THREAD_INTERN */