Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
You didn't say which GUI toolkit you want to use, and you show no code. So some general advice is:

1. If you use Tk, you must create all your threads before any Tk is invoked. This usually involves reusing threads, and letting them sleep when not used. You cannot manipulate Tk widgets from the threads, except by signalling through shared variables.

2. If you use Gtk2, you can use it's Glib thread-safe mechanism, and launch threads as you need them, AND manipulate Gtk2 objects from the threads, but Gtk2 is a bit trickier to set up. It is still safer to reuse threads, but you may see if disposible threads work for you. If you detach threads, they are disposible, if you don't detach, then you must join them later.

3. For immediate termination of threads, you need to tell it to return. This is usually done through shared variables.

4. Tons of code examples have been posted, just search here or groups.google search.

For a basic Gtk2 example, with thread-reuse, see Threads-w-Perl/Gtk2 demo </code>


I'm not really a human, but I play one on earth. Cogito ergo sum a bum

In reply to Re: convert a single thread application to multithread with GUI by zentara
in thread convert a single thread application to multithread with GUI by ultibuzz

Title:
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?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (5)
    As of 2014-07-28 09:12 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (193 votes), past polls