summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-03-28 03:37:23 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-03-28 03:37:23 +0000
commitc4e7bd8d7008b59d7502296f4da5ed2d4592e5f9 (patch)
tree7395a7632b94549966152dad92428db85e84b79d /ext
parentfd3835b3e90ede5576a7ad392beef86bf933ce15 (diff)
downloadperl-c4e7bd8d7008b59d7502296f4da5ed2d4592e5f9.tar.gz
integrate change#3179 from maint-5.005
p4raw-link: @3179 on //depot/maint-5.005/perl: 3c798f74a641ef1819699fe5d5c156d30ad033bc p4raw-id: //depot/perl@3181 p4raw-integrated: from //depot/maint-5.005/perl@3180 'merge in' t/lib/thread.t (@1649..) ext/Thread/Thread.xs (@2543..)
Diffstat (limited to 'ext')
-rw-r--r--ext/Thread/Thread.xs6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/Thread/Thread.xs b/ext/Thread/Thread.xs
index 543ecf00cf..c3b468314a 100644
--- a/ext/Thread/Thread.xs
+++ b/ext/Thread/Thread.xs
@@ -238,6 +238,11 @@ newthread (SV *startsv, AV *initargs, char *classname)
savethread = thr;
thr = new_struct_thread(thr);
+ /* temporarily pretend to be the child thread in case the
+ * XPUSHs() below want to grow the child's stack. This is
+ * safe, since the other thread is not yet created, and we
+ * are the only ones who know about it */
+ SET_THR(thr);
SPAGAIN;
DEBUG_S(PerlIO_printf(PerlIO_stderr(),
"%p: newthread (%p), tid is %u, preparing stack\n",
@@ -251,6 +256,7 @@ newthread (SV *startsv, AV *initargs, char *classname)
PUTBACK;
/* On your marks... */
+ SET_THR(savethread);
MUTEX_LOCK(&thr->mutex);
#ifdef THREAD_CREATE