CV *cv = GvCV(gv);
if (!PL_endav)
PL_endav = newAV();
- av_unshift(PL_endav, 1);
SvREFCNT_inc(cv);
- if (!av_store(PL_endav, 0, (SV *) cv))
+ if (!av_store(PL_endav, av_len(PL_endav) + 1, (SV *) cv))
SvREFCNT_dec(cv);
sv_magicext((SV *) PL_endav, NULL, PERL_MAGIC_ext, &tc_endav_vtbl, NULL, 0);
}
=item *
-For pseudo-forks, it will be called when C<waitpid> succeeds, after any C<END> block local to the spawn process but before any global C<END> block ;
+For pseudo-forks, it will be called when C<waitpid> succeeds, after any local or global C<END> block ;
=item *
Thread::Cleanup::register {
pass 'pseudo-fork destructor called';
is $local_end, 1, 'pseudo-fork destructor called after local END block';
- is $global_end, 0, 'pseudo-fork destructor called before global END block';
+ is $global_end, 1, 'pseudo-fork destructor called after global END block';
is $gd, 0, 'pseudo-fork destructor called before global destruction';
};