summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-08-11 15:46:29 +0000
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-08-11 15:46:29 +0000
commit0f15f207c55ce70f46ebbd3be6c3d54763665084 (patch)
treed4cbbe278d8bb662e537d2b219246ee872cb20e6 /pp_ctl.c
parent12ca11f6c16e7b63e13bbf5bc251f214e8de5211 (diff)
downloadperl-0f15f207c55ce70f46ebbd3be6c3d54763665084.tar.gz
Assorted changes for multi-threading (now works rather more).
p4raw-id: //depot/perl@44
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 3101e5c1d5..a2074c2933 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2123,6 +2123,7 @@ OP *o;
return Nullop;
}
+/* With USE_THREADS, eval_owner must be held on entry to doeval */
static OP *
doeval(gimme)
int gimme;
@@ -2134,14 +2135,6 @@ int gimme;
CV *caller;
AV* comppadlist;
-#ifdef USE_THREADS
- MUTEX_LOCK(&eval_mutex);
- if (eval_owner && eval_owner != thr)
- while (eval_owner)
- COND_WAIT(&eval_cond, &eval_mutex);
- eval_owner = thr;
- MUTEX_UNLOCK(&eval_mutex);
-#endif /* USE_THREADS */
in_eval = 1;
PUSHMARK(SP);
@@ -2406,6 +2399,14 @@ PP(pp_require)
compiling.cop_line = 0;
PUTBACK;
+#ifdef USE_THREADS
+ MUTEX_LOCK(&eval_mutex);
+ if (eval_owner && eval_owner != thr)
+ while (eval_owner)
+ COND_WAIT(&eval_cond, &eval_mutex);
+ eval_owner = thr;
+ MUTEX_UNLOCK(&eval_mutex);
+#endif /* USE_THREADS */
return DOCATCH(doeval(G_SCALAR));
}
@@ -2458,6 +2459,14 @@ PP(pp_entereval)
if (perldb && curstash != debstash)
save_lines(GvAV(compiling.cop_filegv), linestr);
PUTBACK;
+#ifdef USE_THREADS
+ MUTEX_LOCK(&eval_mutex);
+ if (eval_owner && eval_owner != thr)
+ while (eval_owner)
+ COND_WAIT(&eval_cond, &eval_mutex);
+ eval_owner = thr;
+ MUTEX_UNLOCK(&eval_mutex);
+#endif /* USE_THREADS */
ret = doeval(gimme);
if (perldb && was != sub_generation) { /* Some subs defined here. */
strcpy(safestr, "_<(eval )"); /* Anything fake and short. */