AnyEvent recursive blocking wait with Plack
Marc Lehmann
schmorp at schmorp.de
Wed Mar 7 21:23:41 CET 2012
On Tue, Mar 06, 2012 at 04:59:45PM -0800, Mike Schilli <anyevent at perlmeister.com> wrote:
> I'm hitting the 'recursive blocking wait' limitation in AnyEvent and
> wonder how to work around it.
I can't quite grok Plack::Handler::AnyEvent::HTTPD, but maybe it supports
returning a code reference for just that reason?
I.e. instead of returning data, you might be able to do this:
sub request {
sub {
my $respond = shift;
my $w; $w = AE::timer 5, 0, sub {
undef $w;
$respond->("go away, time is up");
};
}
}
At least, this code in the module seems to suggest that:
my $res = Plack::Util::run_app($self->{app}, $env);
...
ref $res eq 'CODE' ? $res->($respond) : $respond->($res);
If that is true, then more or less the only thing that is supported in the
requets callback is returning the code reference, and the code reference then
gets a continuation object.
I don't know if this is supported, or if other plack handlers support
this, and I don't know whether this handler really works concurrently, but
at least it looks as if some effort has been made to achieve that.
(I hope it gets clear from the above that I really don't know nothing
about Plack).
--
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / schmorp at schmorp.de
-=====/_/_//_/\_,_/ /_/\_\
More information about the anyevent
mailing list