Workaround for using synchronous modules in AnyEvent?

Mike Schilli anyevent at perlmeister.com
Fri Apr 5 18:10:49 CEST 2013


I'm using AnyEvent somewhat uncleanly with a library that makes
synchronous socket calls. Crazy, I know!

The library (if you're curious, it's Net::ZooKeeper, and noone seems to
have written a AnyEvent module, guess I'll have to do that myself at
some point) is very fast, though, sends a request to a Unix socket and
usually gets a response within a couple of milliseconds, so I kind of
lived with the fact for a while that AnyEvent doesn't get around to
handle other events in meantime.

So, I was looking for a quick solution to fix that and stumbled across
Coro, which offers threading, but alas, I think it blocks on I/O.

Does anyone have any solution, or should I just start on writing .xs
code for a ZooKeeper client that utilizes ZooKeeper's single-threaded
library for a new and truly asyncronous AnyEvent::ZooKeeper module?

-- 
-- Mike

anyevent at perlmeister.com



More information about the anyevent mailing list