Now why would that be?

google for "perl threads copy on create"

...for Tk all 3 are correct....Tk goes out of it's way to bite you on the a*s when used with threads..... the real problem is that your experiments may work occaisionally, but then not when a different widget set involved, or different system speed or load..... etc etc etc... so you think you are figuring out a pattern.....then it turns out different on some other machine

... in Tk with threads, you need to keep all Tk code in the main thread of the parent process where the Tk mainloop runs....and you need to create the threads before any Tk code statements are made

...if you want to do what you are attempting..... create threads in gui button callbacks, or in some manner after the gui code has started.... use Gtk2....it is more advanced than Tk... see Gtk2 ....needs thread testing on a multi-threaded computer for how to do it, with the GLib::IdleAdd method, and the attempt at builtin object thread safety of Gtk2

.... i don't know about Storable's thread safety problems, but you can probably get around the problem the same way as Tk.... create your thread first thing in the code, and confine the storable code to a single thread

....another trick to try, is to create your object in the parent thread, and try to pass it as a reference into the thread creation command

$thread = threads->new(\&work , $object_ref);
.... sometimes that works, sometimes not

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku

In reply to Re: Perl Tk and threads by zentara
in thread Perl Tk and threads by nikosv

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!
  • 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, details, 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, summary, 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.