in reply to Re: Using Perl Threads with Expect.pm
in thread Using Perl Threads with Expect.pm

I am using threads to run B and C because threadA is also running. I believe that threadA would block the main thread until I do a join on it. Is my understanding wrong?
  • Comment on Re^2: Using Perl Threads with Expect.pm

Replies are listed 'Best First'.
Re^3: Using Perl Threads with Expect.pm
by vishi (Beadle) on Feb 17, 2011 at 13:55 UTC
    According to : http://search.cpan.org/~rgiersig/Expect-1.21/Expect.pod#Is_it_possible_to_use_threads_with_Expect?

    Is it possible to use threads with Expect? Basically yes, with one restriction: you must spawn() your programs in the main thread and then pass the Expect objects to the handling threads.

    If I don't do this, or call create an Expect object in the main thread, the remote session is 'blocked', unless I pass the expect object to the thread subroutine...
Re^3: Using Perl Threads with Expect.pm
by bart (Canon) on Feb 17, 2011 at 19:33 UTC
    You misunderstand me. What I tried to say was not "Why threads?" but "Why 2 child threads, B and C?", thus: why are B and C 2 different threads instead of just one?

      Oh that! Well, ThreadB is doing stuff on a different server than ThreadC... so I need 2 threads to work across 2 machines.

        Yes but bart's point still stands. Why can't you use one thread to connect to machine b, then connect to machine c. Rinse and repeat. Expect doesn't require you to connect to only one machine per thread does it?