in reply to Re: Perl Threads Question.
in thread Perl Threads Question.
Thank you for your answer.
"I'm not sure why you've posted the fork code if your question is about threads? But...."
I had thought every fork was a thread.... And a call to fork() started a child process and returned the PID of that process.
I had heard fork() leakes like a sieve even in 12. so a threads version would be very helpful. However I am not proficient enough to follow your code completely.
download#! perl -slw use strict; use threads; my @threads = map async( sub{ my( $num, $sleep ) = @_; print "started HTTP CALL"; print "done with HTTP CALL return results";return $num; }, print "Done with 10 HTTP CALLS RETURN RESULTS", $_->join for @threads; # I am assuming @threads now holds the 10 results for each child proce +ss. Correct?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Perl Threads Question.
by BrowserUk (Patriarch) on Oct 05, 2010 at 03:02 UTC | |
by Monkomatic (Sexton) on Oct 18, 2010 at 14:32 UTC |