summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorArtur Bergman <sky@nanisky.com>2003-02-01 12:01:01 +0000
committerArtur Bergman <sky@nanisky.com>2003-02-01 12:01:01 +0000
commitc2f2a82b809cca4067f3f96f30c6d54de2eb4d18 (patch)
tree3b33a53d9349b0f81fe6d5635521c48f4954f863 /ext
parent3d652ca540f5b59788357df4adce38e81a303fc5 (diff)
downloadperl-c2f2a82b809cca4067f3f96f30c6d54de2eb4d18.tar.gz
Don't free thread before using it, breaks platforms that
trust that I really want to free what I free, (like HPUX and AIX). p4raw-id: //depot/perl@18615
Diffstat (limited to 'ext')
-rwxr-xr-xext/threads/threads.xs20
1 files changed, 9 insertions, 11 deletions
diff --git a/ext/threads/threads.xs b/ext/threads/threads.xs
index 043f76202f..c9c20636b2 100755
--- a/ext/threads/threads.xs
+++ b/ext/threads/threads.xs
@@ -91,7 +91,6 @@ 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);
@@ -123,26 +122,25 @@ Perl_ithread_destruct (pTHX_ ithread* thread, const char *why)
#endif
MUTEX_UNLOCK(&create_destruct_mutex);
/* Thread is now disowned */
- if (thread->interp) {
+
+ if(thread->interp) {
dTHXa(thread->interp);
+ ithread* current_thread;
PERL_SET_CONTEXT(thread->interp);
+ PERL_THREAD_GETSPECIFIC(self_key,current_thread);
+ PERL_THREAD_SETSPECIFIC(self_key,thread);
SvREFCNT_dec(thread->params);
thread->params = Nullsv;
- destroyperl = thread->interp;
+ perl_destruct(thread->interp);
+ perl_free(thread->interp);
thread->interp = NULL;
+ PERL_THREAD_SETSPECIFIC(self_key,current_thread);
+
}
MUTEX_UNLOCK(&thread->mutex);
MUTEX_DESTROY(&thread->mutex);
PerlMemShared_free(thread);
- if(destroyperl) {
- ithread* current_thread;
- PERL_THREAD_GETSPECIFIC(self_key,current_thread);
- PERL_THREAD_SETSPECIFIC(self_key,thread);
- perl_destruct(destroyperl);
- perl_free(destroyperl);
- PERL_THREAD_SETSPECIFIC(self_key,current_thread);
- }
PERL_SET_CONTEXT(aTHX);
}