Use of condvar in a callback of another event
Michael Fung
mike at 3open.org
Sun Mar 17 12:28:42 CET 2013
Hi all,
I still feel nausea for event driven programming #-{
I have the following sub which use a condvar to wait for result, but
this sub will be called in a callback of another event. Will this
"nesting" have undesirable effects during high load?
[code]
# $redis is an EV::Hiredis object already created
sub do_auth {
my $result = 0;
my $cv = AE::cv;
$redis->hmget( "xxx", 'aaa', 'bbb',
sub {
# check result and set $result ...
$cv->send;
});
$cv->recv;
return $result;
}
[/code]
Rgds,
Michael
More information about the anyevent
mailing list