in reply to Re^4: Help needed with regard to arrays
in thread Help needed with regard to arrays

(if there is a server that is not available for instance, the ssh command sits there till it times out before moving to the next one)

What did you expect the ssh command or subroutine to do?

Or do you mean to say that only ever one ssh subroutine is connecting/running, despite that you think you're running the subroutine in many threads? I'm not sure that the ssh libraries are threadsafe.

  • Comment on Re^5: Help needed with regard to arrays

Replies are listed 'Best First'.
Re^6: Help needed with regard to arrays
by theknightsofni (Novice) on Nov 20, 2008 at 20:36 UTC
    Yes...only 1 is connecting/running. I am using ssh through a system() call

      Maybe you can show us your code? I have a hard time imagining your code.

        my $jobs = Thread::Queue->new(@stores); # read work file sub processWF { my $val = shift; open(WORKFILE, "<$workFile"); my @lines = <WORKFILE>; #@lines = sort @lines; #chop @lines; while (defined (my $item = $jobs->dequeue)) { foreach my $line (@lines) { $line =~ s/storeplaceholder/$item/; print "running: $line"; system($line); } } close(WORKFILE); } $jobs->enqueue(undef) for 1..$max_thread_count; my @workers = map { threads->create( \processWF ) } 1..$max_thread_cou +nt;
        The code reads a file which has something like ssh storeplaceholder -l xyz "/usr/bin/ls"