It hangs because the catpure thread is at the loop function, my idea is to break that loop using breakloop over the same variable BUT from the main thread.
1- Yes, i've done some tests and looks that 0 is doing exactly the same as -1, but i've changed to -1 now.
2- The callback part works perfectly, i've just remove the contents for the test.
3- Nothing strange at the return codes of the subs.
The problem here is that I can't call breakloop to the same variable at the main thread that is looping at the capture thread and thats why it hangs at the loop function.
I've try it sharing, passing as a parameter to the thread (don't know why it makes a local copy too instead of using the same by reference), i've tried too the last 2 options but using references and found that althoug the references are being copied (as i expected) the content of the references changed too to the copied values inside the thread instead of pointinng to the original variable at the main thread.
I thought it will be easier.

In reply to Re^8: Shared variables between threads by Saladino
in thread Shared variables between threads by Saladino

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.