On Wed, 31 Dec 2003 11:19:58 -0800, Jan Dubois <jand@ActiveState.com> wrote: >It actually had been committed: > >http://public.activestate.com/cgi-bin/perlbrowse?patch=17476 > >Unfortunately it has been backed out again: > >http://public.activestate.com/cgi-bin/perlbrowse?patch=18615 > >And the original problem, of course, is back. :( I've attached what I think is the correct patch to fix the problem of detached threads crashing on exit (at least on Windows). The patch was created (and tested) against 5.8.3, but should be applied to bleadperl. Cheers, -Jan --- ext/threads.xs.orig Thu Jan 22 16:35:40 2004 +++ ext/threads.xs Thu Jan 22 16:41:39 2004 @@ -93,6 +93,7 @@ void Perl_ithread_destruct (pTHX_ ithread* thread, const char *why) { + PerlInterpreter *freeperl = NULL; MUTEX_LOCK(&thread->mutex); if (!thread->next) { Perl_croak(aTHX_ "panic: destruct destroyed thread %p (%s)",thread, why); @@ -144,12 +145,14 @@ thread->params = Nullsv; perl_destruct(thread->interp); - perl_free(thread->interp); + freeperl = thread->interp; thread->interp = NULL; } MUTEX_UNLOCK(&thread->mutex); MUTEX_DESTROY(&thread->mutex); PerlMemShared_free(thread); + if (freeperl) + perl_free(freeperl); PERL_SET_CONTEXT(aTHX); }Thread Previous | Thread Next