http://www.perlmonks.org?node_id=1022094


in reply to Re^3: Program Design Around Threads
in thread Program Design Around Threads

That's just it though. This isn't true: "Each thread it using a different file, so no conflicts or ordering problems arise. No need for locking or semaphores or synchronisation." There are as many threads running as there are machines and commands. For Example:

tid1 -> machine1 -> "show running-config" takes 30 seconds to get reply.

tid2 -> machine2 -> "show running-config" takes 30 seconds to get reply

tid3 -> machine1 -> "show vlan" takes 5 seconds to get reply.

tid4 -> machine2 -> "show vlan" takes 5 seconds to get reply.

Since tid 3&4 finish first, my 2 output files now have show vlan at the top instead of show running-config because those threads finished before thread 1&2 and wrote contents into file machine1.txt and machine2.txt. Maybe I am missing something?