Curses and AnyEvent
Marc Lehmann
schmorp at schmorp.de
Fri Jan 25 10:42:56 CET 2013
On Thu, Jan 24, 2013 at 10:11:49PM -0800, Mike Schilli <anyevent at perlmeister.com> wrote:
> >That means that failing everything else, one could use that POE module
> >- AnyEvent should just work on top of POE or whatever POE uses.
>
> Ou la la, and it works indeed.
Good to hear that.
There is only one trap when mixing other "frameworks" like this: it might not
be healthy to call into POE callbacks from AnyEvent callbacks, because POE
might not expect to be called from there.
For example, when POE uses EV and AnyEvent also uses EV (as opposed to
AnyEvent using the POE backend) then you usally run POE's "mainloop", i.e.
it blocks for you.
Eventually POE calls into EV to handle events, and this is where AnyEvent
hooks into as well.
Calling back to POE from inside an AnyEvent callback might therefore
happen at a time when POE doesn't expect any callbacks (after all, it's
blocking in the event loop and doesn't expect to be re-entered at this
time).
So in these cases, one should either:
- force the AnyEvent::POE implementation, which sits on top of POE
(when such an implementation is available).
- never call POE functions from AnyEvent callbacks.
- find out whether this is a problem with the framework in question (after
all, if e.g. POE uses EV, then it shouldn't be surprised if other code uses
EV directly).
I don't actually know if POE has problems with that, it's been a long
time that I looked into it, but it's a problem in general with most large
frameworks.
--
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