Yes, this shouldn't be hard. Link gevent against libev shared library.
Then link your C extension against libev shared library.
If you're in a single-threaded program and only need one event loop then just
use the default event loop in the your C module. The Hub created in
the main thread
of Python program also uses the default loop.
I'm not familiar with libev internals. If you can't control the C code
so that your calls through the python binding can eventually call
get_hub().wait() then perhaps you need to isolate the module calls to
a separate thread. The C module code can then run without a greenlet
context. Some of your binding would be cython which bridges between
the greenlet calling the operation and the C module code servicing it.
That's the most understanding I can get staring at this code for a
half hour. I can't actually even find documentation for libev. Maybe
it's one of those "read the code" libraries (I hear the API is
simple). Anyway. Hopefully Denis can chime in again.
Does this sound like what you have in mind, Vijay?
-R
Sorry, not quite.
BTW, here's an example of a C library integrating with gevent:
http://initd.org/psycopg/docs/advanced.html#support-to-coroutine-libraries
On Sat, Apr 30, 2011 at 2:01 AM, Randall Leeds <randal...@gmail.com> wrote:
> That's the most understanding I can get staring at this code for a
> half hour. I can't actually even find documentation for libev. Maybe
> it's one of those "read the code" libraries (I hear the API is
> simple).
Libev has very good documentation:
http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod