develooper Front page | perl.perl5.porters | Postings from January 2004

Re: threads::shared::queue;

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
January 23, 2004 14:50
Subject:
Re: threads::shared::queue;
Message ID:
20040123225052.GH23250@fdisolutions.com
On Thu, Jan 22, 2004 at 07:18:46PM -0800, Jan Dubois wrote:
> On Thu, 22 Jan 2004 18:23:07 -0800, Jan Dubois <jand@ActiveState.com> wrote:
> 
> 
> >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.
> 
> Oops, the patch was wrapped.  This is the correct one.
> 

Thanks, applied to bleed as change #22201

PS - from Porting/patching.pod:

    IMPORTANT: Patches should be generated from the source root directory,
    not from the directory that the patched file resides in.  This ensures
    that the maintainer patches the proper file.

(and more to the point, makes life easy for lazy patch appliers :-)

Dave.


> >Cheers,
> >-Jan
> 
> --- threads.xs.orig	Thu Jan 22 16:35:40 2004
> +++ 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);
>  }

-- 
print+qq&$}$"$/$s$,$*${d}$g$s$@$.$q$,$:$.$q$^$,$@$*$~$;$.$q$m&if+map{m,^\d{0\,},,${$::{$'}}=chr($"+=$&||1)}q&10m22,42}6:17*2~2.3@3;^2dg3q/s"&=~m*\d\*.*g

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About