Hello everybody,

First of all, thanks for such good piece of software.
I'm not sure if this is the right list to ask my question, but i couldn't
find AnyEvent list, so here i am.

All of the following is related to Perl only.

I have a few classes. Each has associated storage class. Now when some event
happens (like terminal input), i want to read data from all storage classes
available (or not all, want to make this configurable really). I'm using
AnyEvent::AIO for readings. Here is an example code, which i need to sync
somehow (using timer event is just an example).

AnyEvent->timer(after => 1 , cb => sub {
my $data = "";
foreach my $storage (@storages) {
my $buf;
aio_load $storage->file , $buf , sub {
$data .= $buf;
}
}

# need to wait until all aio_load finishes
print $data , "\n";
});

I think it's clear why it's not working.. I was trying to use condvar->send
, condvar->recv with no success, because i don't know how to determine where
from call condvar->send, it seems that it should be called after the last
aio_load executes... but i don't know how to determine if it's the last
aio_load..

P.s. i'm using EV as backend model for AnyEvent.

-- 
Regards,
Mikhail
_______________________________________________
libev mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev

Reply via email to