At 13:13 +0100 13.07.2005, Paul Sobey wrote:
Has anyone had any experience in writing multi-threaded processes on
Windows using libwww-perl? ...
One method that works well for me is to start a fixed number of worker
threads when you script starts, then feed jobs to them from your main
thread. This speeds things up because you don't get the overhead of
cloning the interpreter over and over ...
Yes, I was considering something like this. This would certainly be
the elegant way to do it, but at the moment I'm leaning towards the
quick'n'dirty solution of simply firing off Win32 processes, which
won't involve me in back-and-forth cross-thread communications (my
workers will need to be able to tell the boss when they're still busy
and can't take on new tasks) and won't risk causing the inexplicable
crashes I've seen with threads. Speed is not really an issue, because
my tasks involve downloading multi-megabyte files from remote servers
on slow connections: any time saved by using threads would be lost in
the overall time taken to download. Memory and CPU impact from
running multiple interpreters is more of an issue, but I think the
target boxes I'm deploying on can handle the load.
Once again, the need to have it done by yesterday trumps elegant
design, but if I ever get time to rewrite this, I might do it the way
you suggest.
Thanks to everyone else who also wrote with suggestions.
Angus
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs