is there a way to avoid the error ?

This is just a basic piece of advice when running threads from a gui. Most GUI's are not thread safe, meaning you should not invoke any GUI code BEFORE launching your threads. This is because perl threads copy the entire parent process when they are initiated, and if GUI code is already in the main code, you get multiple ( often error causing) copies of the gui code in the different threads.

Now some GUI toolkits do offer some thread safety, like Gtk2, Gtk3, and others based on the Glib system. I don't know about your gui toolkit, but I would guess it's non-thread-safety the source of the problem.

The most reliable way to avoid the issue, is to create all your threads before any GUI code is invoked in your parent, AND do not put any GUI code into your threads.

I only have an example with Tk , but it should show you the idea. See Re: Perl Tk and Threads or you can google for "perl tk thread safety" and get alot of examples.


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

In reply to Re: Threads and TCL DeleteInterpProc by zentara
in thread Threads and TCL DeleteInterpProc by x-lours

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.