If you are not calling exit, maybe you are calling die somewhere? Just google the SuperSearch here for threads, and you will find hundreds of real world thread problems with Perl. The big problem is thread-safety. Since your original node said

s there a way to stop the thread->join from closing all spawn_ids?

I would suspect that there is a thread safety issue where your threads are getting confused as to who "owns" what code. Part of thread safety is to try and isolate objects into their respective threads, so they don't get crossed linked( when a thread is spawned it gets an exact copy of the parent thread at the time of spawning, so you often CANNOT spawn threads at any time, because the new thread will a copy of all of the previously spawned threads). Anyways, since you are not willing to show a code example, we can't spot any obvious mistakes. You might want to try fork-and-exec rather than threads if you are having trouble. See parallel ssh or you might want to try Net::SSH2 which is supposedly thread safe. Also try googling for "perl Net::SSH2 thread safe" and see what others have tried. You may need an pty , see scp progress logging.

The safest way for you to do this may be to spawn your 3 threads right at the start of your program, then pass in the expect ssh stuff in string to be eval'd in each thread, using shared variables.


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

In reply to Re^3: Expect spawn_id and threads by zentara
in thread Expect spawn_id and threads by lakputcha

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.