summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2014-01-20 12:03:15 +0000
committerDavid Mitchell <davem@iabyn.com>2014-01-20 12:03:15 +0000
commit78f43036056af97e4b7556377cfdb68969aab8d4 (patch)
tree42564ebe5e66a0ea96dfa1eb9c946c44e57a2ba6
parent20e5bab43efd0e449d0741f5c5a278e7e20ee9dc (diff)
downloadperl-78f43036056af97e4b7556377cfdb68969aab8d4.tar.gz
thrreads::shared: LEAVE in BOOT had wrong context
In Perl_sharedsv_init() - which is called from the threads::shared BOOT code - it creates a new shared interpreter, then tries to undo the ENTER done as the last step of the perl_construct(PL_sharedsv_space) step, with a LEAVE. But the LEAVE was being done in the context of the caller interpreter rather than the shared one. See the thread beginning <52D528FE.20701@havurah-software.org>
-rw-r--r--dist/threads-shared/shared.xs4
1 files changed, 3 insertions, 1 deletions
diff --git a/dist/threads-shared/shared.xs b/dist/threads-shared/shared.xs
index 0d1f1ebeaf..f59a82a6de 100644
--- a/dist/threads-shared/shared.xs
+++ b/dist/threads-shared/shared.xs
@@ -1247,9 +1247,11 @@ void
Perl_sharedsv_init(pTHX)
{
dTHXc;
- /* This pair leaves us in shared context ... */
PL_sharedsv_space = perl_alloc();
perl_construct(PL_sharedsv_space);
+ /* The pair above leaves us in shared context (what dTHX would get),
+ * but aTHX still points to caller context */
+ aTHX = PL_sharedsv_space;
LEAVE; /* This balances the ENTER at the end of perl_construct. */
PERL_SET_CONTEXT((aTHX = caller_perl));
recursive_lock_init(aTHX_ &PL_sharedsv_lock);