Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re^5: ithreads picks fight with LWP::Agent; everybody loses (Works for me!)by BrowserUk (Patriarch) |
on Feb 27, 2008 at 07:52 UTC ( [id://670532]=note: print w/replies, xml ) | Need Help?? |
(had to set stack size to 4*4096, and s/uleep/usleep/) Sorry about the uleep, I changed it in the browser from the Win32::Sleep I used here. I'm surprised you needed to increase the stack size? Your threads don't do much that would consume stack. Or is that a requirement of a 64-bit processor? The main change I made in that version, beyond the logging, was to bypass perl's cleanup. It is usually during this phase that the mysterious, and for the most part inconsequential, "free to wrong pool" errors usually occur. Hence the reason you have to wait so long. The other change was to use shared variables. I suspect that it is this that is the cause of the premature segfault. You could try omitting them and see if bypassing the cleanup with POSIX::_exit(); helps. The problem here is that if you join the threads, the cleanup is triggered early and the problem will arise. If you detach them, your main thread has nothing to wait on. That's what I used the shared vars and monitor thread to achieve. Generally, I don't expect that iThreads have been exercised much on 64-bit builds. Finally, I wouldn't recommend threads or forks for this type of usage. Both are to heavy for this purpose. An IO::Select or a LWP::Parallel will use far less resources for too much greater effort. Best of all, they are more likely to work in your environment. Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In Section
Seekers of Perl Wisdom
|
|