On 17/10/16 19:59, Gonzalo Diethelm wrote:
I am wondering how one goes about plugging a library into libuv. For
example, I am playing around with MariaDB's connector, which supports
querying a MariaDB / MySQL database in async mode. You can see more
here: https://mariadb.com/kb/en/mariadb/using-the-non-blocking-library/

Basically, for each blocking operation XXX this library gives you two
functions: XXX_start(), which initiates the operation, and XXX_cont(),
which should be called when the underlying file descriptor has indicated
the operation could (partially) progress. It is very straightforward and
event loop-ready; they provide a libevent-based example.

So, what is the correct approach to incorporate this library into libuv,
so that from a libuv loop I could multiplex between doing file I/O,
socket I/O and MariaDB-based I/O?

I have never attempted that integration, but if it provides a file descriptor based interface you can use uv_poll_t http://docs.libuv.org/en/v1.x/poll.html and call the appropriate library functions when the fd is readable / writable.

That's for example how c-ares is integrated with libuv in Node.


Saúl Ibarra Corretgé

You received this message because you are subscribed to the Google Groups 
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to libuv+unsubscr...@googlegroups.com.
To post to this group, send email to libuv@googlegroups.com.
Visit this group at https://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.

Reply via email to