summaryrefslogtreecommitdiff
path: root/ext/threads
diff options
context:
space:
mode:
authorArtur Bergman <sky@nanisky.com>2002-07-11 05:35:53 +0000
committerArtur Bergman <sky@nanisky.com>2002-07-11 05:35:53 +0000
commit3deee5e760ff3fc044aa7c8744455c6f9aa338cb (patch)
tree45449f963a3cb6105ce9ba03c3321528ff29aaf4 /ext/threads
parent32419a4c4b0d4e513a7ca9f706bbde8c03c40c61 (diff)
downloadperl-3deee5e760ff3fc044aa7c8744455c6f9aa338cb.tar.gz
Problem fixed with detached threads reported by Stacy Maughan
and debugged by Jan Dubois. Problem occured when a thread cleared itself out and then switched back to itself (which was gone) and wanted a function pointer for the PerlMemShared free. p4raw-id: //depot/perl@17476
Diffstat (limited to 'ext/threads')
-rwxr-xr-xext/threads/threads.xs8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/threads/threads.xs b/ext/threads/threads.xs
index 88aaf0eaf7..41732994a5 100755
--- a/ext/threads/threads.xs
+++ b/ext/threads/threads.xs
@@ -91,6 +91,7 @@ perl_key self_key;
void
Perl_ithread_destruct (pTHX_ ithread* thread, const char *why)
{
+ PerlInterpreter* destroyperl = NULL;
MUTEX_LOCK(&thread->mutex);
if (!thread->next) {
Perl_croak(aTHX_ "panic: destruct destroyed thread %p (%s)",thread, why);
@@ -127,14 +128,17 @@ Perl_ithread_destruct (pTHX_ ithread* thread, const char *why)
PERL_SET_CONTEXT(thread->interp);
SvREFCNT_dec(thread->params);
thread->params = Nullsv;
- perl_destruct(thread->interp);
- perl_free(thread->interp);
+ destroyperl = thread->interp;
thread->interp = NULL;
}
PERL_SET_CONTEXT(aTHX);
MUTEX_UNLOCK(&thread->mutex);
MUTEX_DESTROY(&thread->mutex);
PerlMemShared_free(thread);
+ if(destroyperl) {
+ perl_destruct(destroyperl);
+ perl_free(destroyperl);
+ }
}
int