in reply to Re: Issue with Threads while collecting command output
in thread Issue with Threads while collecting command output
The only thing I can see wrong, which may cause hanging, is the way you wait for the thread joins to occur.
Since he is waiting for all threads to finish, the order in which they are joined is irrelevant.
And using your method, if the first thread (or the first two or the first three) are not yet ready when he tests to see if they are joinable, they will never be joined because your for loop will end and you never go back to re-try them.
You would have to code that as:
while( @threads ) { foreach (@threads) { if ( ( $_ -> is_joinable) { $_->join(); } } }
But that would be pointless.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Issue with Threads while collecting command output
by zentara (Cardinal) on Nov 08, 2011 at 16:42 UTC |