Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
I need a way to pause multithreaded Tkx application (threads are collecting some data via HTTP). Threads push data to the queue so the main application can read it (and show to the user). Customer want to pause the program if one of the threads find some data. By pause i mean stop updating text log widget. Here is code:
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!" ); }
So i have one problem: how to pause all running threads (and continue them after some user actions)?

In reply to How to pause multithreaded application? by Gangabass

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (5)
    As of 2015-05-30 02:44 GMT
    Find Nodes?
      Voting Booth?

      In my home, the TV remote control is ...

      Results (593 votes), past polls