develooper Front page | perl.perl5.porters | Postings from April 2003

Re: 5.8.1@19053: threads goofs

Thread Previous | Thread Next
From:
Jarkko Hietaniemi
Date:
April 3, 2003 20:31
Subject:
Re: 5.8.1@19053: threads goofs
Message ID:
20030404043101.GI14115@vipunen.hut.fi
> > The Perl_ithread_hook() function generates the warning
> > if active_threads != 1 and aTHX == PL_curinterp (ie a thread is
> > destroying it's 'own' interpreter and not an interpreter created
> > for another thread).
> 
> How can the latter happen?  Moreover, this does not happen when a

That can happen very easily.

-e 'threads->new(sub{1 while 1})'

The main thread falls off the end, and starts destroying its own
interpreter.  The _other_ interpreter is the one patiently executing
'1' hoping that '1' will become false.  It's the main thread / main
interpreter giving the warning when it's on its way out.  The
sub/child thread/interpreter is shutdown more unceremoniously and gets
to say nothing.

> thread terminates non-violently, so your description does look
> applicable.
>
>   perl -Mthreads -wle "threads->new(sub{}); sleep 10"
> 
> > The Perl_ithread_hook() function is only called by perl_destruct().
> > And perl_destruct() has no knowledge of why the interpreter is being
> > destroyed.
> 
> Please show how this message may be triggered without the process
> immediately ending.

You are right on that the whole process dies but you are confusing
effects with side-effects.  The message we are arguing over is caused
by a side-effect.  The final effect is, of course, that the whole Perl
process dies, but the message is still caused by one particular
side-effect, not by the whole death.

-- 
Jarkko Hietaniemi <jhi@iki.fi> http://www.iki.fi/jhi/ "There is this special
biologist word we use for 'stable'.  It is 'dead'." -- Jack Cohen

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