Vladimir Lipsky wrote:
At the time the main interpreter(one which has no parent) exits, there
could remain some other interpreters being run by detached threads as in
t/pmc/threads_4.pasm.
Thanks, applied.
... The better patch would require
knowledge of a) how many interpreters being alive and b) who heck is the
fery first interpreter, and would do checks like
if ( the_very_last_interpreter )
{
PIO_internal_shutdown( the_very_first_interpreter );
rather than
if ( !interpreter->parent_interpreter )
{
PIO_internal_shutdown( interpreter );
a) interpreter_array traps how many threads are running, and that's not
the same as how many interpreters are running.
Tracking all interpreters isn't needed, I think. If a non-threaded
interpreter is started, it's basically like a subroutine call and that
interpreter will return on termination (see the C<runinterp> opcode).
Therefore it's parent is always alive.
The interpreter_array should have all the info to find a possible
candidate for cleanup.
So instead of testing for !parent_interp it could be done by passing a
I_DESTROY_THE_MESS flag on to that candidate. Originally the first
interpreter has that flag set.
leo