> in your event handler for incoming requests, do something like:
> if ($heap->{still_retrieving}) {
>   push(@{$heap->{requestfifo}, [$postback_to_sender, @requestdata]);
> }


> in the retrieving routine when everything has arrived:
> foreach(@{$heap->{requestfifo}}) {
>   either post($_ ...);
>   or process($_);
> }
> that depends on wether it would be bad if a lot of requests block the
> rest of your program. requests wouldn't get out of order since the
> still_retrieving state change is atomic.

Actually, I've got the blocking handled... I use this idiom:

my $per = 10;

while ($per--) {

        # process a queued value

        last if $no_more;

}

$kernel->yield($current_state) unless $no_more;

This works great where I have, for example, 11,000 rows, and 100 at a time
is fast enough that the rest of the program doesn't halt to badly.  Or 10,
or 50... $per is a tunable setting.

Question, ... never mind.  I was going to ask, what's a good triggering
point to handle all of these queued requests... but that's as simple as:

if ($no_more) {

    # clean state markers

    $kernel->yield($handle_queued_reqs);

} else {

    $kernel->yield($current_state);

}

Right?

:-)

L8r,
Rob

#!/usr/bin/perl -w
use Disclaimer qw/:standard/;


Reply via email to