in reply to Thread Exit Status
First off, you don't want to join threads in the same order that you created them. Probably. Use threads->list(threads::joinable) to find the ones that are done. The downside is figuring out how to wait until some thread is ready (maybe yield()?) This way, you deal with the threads that are ready instead of waiting until the "next" thread is done. Maybe the first thread is grabbing something from a server that's down - by the time it times out, the rest of your threads are already done.
Second, check the threads documentation. It says pretty plainly how to get the return from a thread. That is, $thr->join returns whatever the thread sub returned.
Personally, I'd lean toward using AnyEvent::HTTP - there's a fairly good chance you'll get better performance without threads than with them.
FYI, I use Coro, Coro::LWP (and thus LWP, and AnyEvent::HTTP together to good effect already. In some ways, it's easier than perl threads, in others more complex.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Thread Exit Status
by BrowserUk (Patriarch) on Dec 15, 2011 at 01:00 UTC |