| [reply] |
To get an answer to this, you are going to have to give a much clearer explanation of what you are doing. And the easiest way to do that would be to post (the relevant parts of) the code.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |
Without showing the code, I suspect that one of your threads is calling exit. If any thread (including main thread) calls exit, the whole program exits taking everything with it. Try putting a <>; as the very last line of your main script, so it will hold on until you hit a key to exit.
| [reply] |
Sorry all, can't share code.
As far exit in the code is concerned. I am not calling exit at all.
Subroutine is only return 1 for Success and 0 for false.
I have put <> in my main code and still observed the same behavior.
I have used http://www.xav.com/perl/lib/Pod/perlthrtut.html to understand how Perl Threads work. Is there any other website with more details?
| [reply] |
Sorry all, can't share code.
Good luck then.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |
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 saids 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.
| [reply] |