Search code examples
gliblibuv

libuv vs. glib gio: Which is a better option?


I am looking for a C library for asynchronous I/O, TCP/UDP networking support, threads and event loops. I looked at GLib's GIO, GThread, GMainContext, GMainLoop and also Libuv which is used by Node.js. The functionality is similar. THere seems to be no comparison on these two libraries. I am looking for pure C support on Linux only. I do not care for portability or multiple-language support.

Any suggestions or pointers as to which is relatively easy to use?


Solution

  • GLib/GIO provides more other functionality than libuv, although from the list you’ve provided it looks like like libuv does provide everything you want.

    GObject (which GIO is based on) has a set of conventions which take a bit of time to get up to speed on (though there are documentation and tutorials available); once you’re up to speed on them, they make writing object-oriented code in C fairly painless.

    I haven’t used libuv, so can’t speak for it.