Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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 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

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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 browsing the Monastery: (5)
    As of 2015-11-27 08:20 GMT
    Find Nodes?
      Voting Booth?

      What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

      Results (722 votes), past polls