# catch window close button to clean up threads $mw->protocol('WM_DELETE_WINDOW' => sub { &clean_exit }); sub clean_exit{ my @running_threads = threads->list; if (scalar(@running_threads) < 1){print "\nFinished\n";exit} else{ # $die = 1; # a shared var I usually use # to tell threads to return foreach my $thr (@running_threads){ $thr->join; } exit; } }
In reply to Re^7: Perl/Tk code structure
by zentara
in thread Perl/Tk code structure
by elef
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |