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

Re: 5.8.1@19053: threads goofs

Thread Previous | Thread Next
Jarkko Hietaniemi
April 3, 2003 20:31
Re: 5.8.1@19053: threads goofs
Message ID:
> > 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 <> "There is this special
biologist word we use for 'stable'.  It is 'dead'." -- Jack Cohen

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About