For the INT handler, one can do this. I understand now. You want to display the data already stored in the shared cache.
$SIG{'INT'} = sub { if ( tied(%hash)->len ) { (MCE->wid == 0) ? say 'Parent is ready to dump' : say 'Worker is ready to dump'; say 'Dumping: ' . Dumper \%hash; %hash = (); } MCE::Signal::stop_and_exit('INT'); }; $SIG{'TERM'} = sub { if (MCE->wid > 0) { # worker MCE->exit(0); } else { # parent say 'Parent is ready to dump'; say 'Dumping: ' . Dumper \%hash; MCE::Signal::stop_and_exit('TERM'); } };
In reply to Re: Interrupt multi-process program while using MCE::Shared hash: END block code does not (all) run
by Anonymous Monk
in thread Interrupt multi-process program while using MCE::Shared hash: END block code does not (all) run
by 1nickt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |