Ok, as you have seen in my first e-mail, I have installed Perl 5.8.0 RC2.
Now, I'm moving to RC3 and and tomorrow I will tell you what happens.
Thanks for the moment,

Lino

-----Messaggio originale-----
Da: Elizabeth Mattijsen [mailto:[EMAIL PROTECTED]]
Inviato: martedi 16 luglio 2002 17.32
A: Stas Bekman; Pasquale Pagano
Cc: [EMAIL PROTECTED]
Oggetto: Re: R: worker thread


At 11:19 PM 7/16/02 +0000, Stas Bekman wrote:
>> From the command line, it works very well.
>>We are impleminting a very complex digital library system.
>>In same cases, we want to start parallel threads in order to minimize the
>>wait.
>>Let me try to explain with an example.
>>'A' start 4 threads, each of which prepares, and sends a request to
another
>>server, and then collects its result. When all threads will be terminated,
>>'A' will merge the 4 results.
>>Is now more clear?

You should be able to use Thread::Pool for this.

   $pool = Thread::Pool->new(
    {
     workers => 10, # or higher or lower, max simultaneous requests
     do => sub {fetch from URL and return it},
    } );

    @jobid = ();
    push( @jobid,$pool->job( $_ ) ) foreach @url;
    foreach (@jobid) {
       my $result = $pool->result; # do whatever you want with result X
    }



>your problem is that you use the *old* threads (5005threads, pre-5.6.0),
>whereas mod_perl 2.0 is using ithreads (5.6.0+).
>>>my $t2 = new Thread(\&my_thread,'t2');
>do 'perldoc threads' with perl-5.8.0

Actually, to add to the confusion: only the Thread.pm and Thread::Signal.pm
modules are old 5.005threads modules.  All the other Thread:: namespace
modules (except Malcolm Beattie's old version of Thread::Pool on CPAN) are
new "ithreads" modules.   Only the true "pragma" modules threads.pm and
threads::shared.pm have remaind untouched.  This was changed last week, as
described in Rafael's p5p
summary  http://use.perl.org/article.pl?sid=02/07/15/0732235   ;-)


Liz


Reply via email to