Gangabass has asked for the wisdom of the Perl Monks concerning the following question:
So i have one problem: how to pause all running threads (and continue them after some user actions)?sub start { my @result; $queue= Thread::Queue->new; $queue_processed = Thread::Queue->new; my @domains = get_domains($domains_filename); $queue->enqueue(@domains); my @threads= map { threads->create( sub { create_thread($_) } ) } +( 1 .. $CONFIG{NUMBER_OF_THREADS} ); $_->detach for (@threads); my $counter = 0; while ( $counter < scalar @domains ) { my $result = $queue_processed->dequeue_nb; if ($result) { $txt_processed_domains->configure(-state => "normal"); $txt_processed_domains->insert_end( "$result" ); $txt_processed_domains->see("end"); $txt_processed_domains->configure(-state => "disabled"); Tkx::update(); $counter++; } } Tkx::tk___messageBox( -message => "Completed!" ); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to pause multithreaded application?
by BrowserUk (Patriarch) on Sep 14, 2010 at 10:24 UTC | |
Re: How to pause multithreaded application?
by zentara (Cardinal) on Sep 14, 2010 at 10:22 UTC | |
Re: How to pause multithreaded application?
by Corion (Patriarch) on Sep 14, 2010 at 10:01 UTC | |
Re: How to pause multithreaded application?
by Anonymous Monk on Sep 14, 2010 at 10:06 UTC | |
by BrowserUk (Patriarch) on Sep 14, 2010 at 10:27 UTC | |
by Anonymous Monk on Sep 14, 2010 at 20:41 UTC | |
by Your Mother (Archbishop) on Sep 14, 2010 at 22:59 UTC | |
by BrowserUk (Patriarch) on Sep 15, 2010 at 01:03 UTC |