← Back to team overview

drizzle-discuss team mailing list archive

Re: libdrizzle: integration with another event loop


Evan Jones wrote:
* Is it possible to get the sockets being used by libdrizzle? It might be possible to add them to my own libevent loop, and call libdrizzle when there is stuff to do, rather than relying on drizzle_con_wait() to block. This would be relatively straightforward for reads, but is tricky in the case of "write blocked" events, since they need to be turned on and off on demand.

This is clearly a good way to go. Reading through the source, it appears that drizzle_set_event_watch_fn is actually a function that *requests* I/O callbacks from an external mechanism. When I first browsed through the API, I thought it was something that was called when events are ready.

This is perfect, although I don't get what I'm supposed to do to *act* on the callback. For example, what if writing the query blocks, how do I resume the write? Looking at examples/client.c, it appears to keep calling drizzle_query() until it returns DRIZZLE_RETURN_OK? This doesn't seem right to me when I follow the code. It seems like this will cause the query to be issued multiple times?

It seems like maybe what I need to do is call drizzle_state_loop()?

Once I figure this stuff out, I'll contribute an example for libdrizzle. Thanks,

Evan Jones

Evan Jones

Follow ups