On Nov 17, 2009, at 16:06 , Eric Day wrote:
Yes, you should be calling drizzle_con_revents() when the libevent callbacks notify that a fd is ready for read/write. You are providing a replacement for drizzle_con_wait().
This is very interesting, because it seems to work for me (for the moment) without doing this. I'll look into this more carefully.
In your event_watch_fn, you should be setting the appropriate POLLIN/POLLOUT equivalents in libevent for the fd. When a fd is active and one of the libevent callbacks is fired, you should be clearing the ready events (otherwise you'll get a busy spin, especially on POLLOUT) and call drizzle_con_revents() to let the library know what is ready.
What do you mean by "clear" the event? To me, that means "stop waiting for the event." My experience, and looking at the gearman example, it seems that I need to *continue* waiting for events. As you note, this is tricky with write events, unless libdrizzle immediately says "no longer interested."
Similarly, I'm confused how to deregister when a connection is closed. Is it safe to assume the answer is "you need to deregister when you close/free the connection"?
I use a very similar event model in Gearman, and the server for that has an example of libevent integration.
This is a great example. Thanks. Evan -- Evan Jones http://evanjones.ca/ _______________________________________________ Mailing list: https://launchpad.net/~drizzle-discuss Post to : [email protected] Unsubscribe : https://launchpad.net/~drizzle-discuss More help : https://help.launchpad.net/ListHelp

