RFC: Listening for devices being added - udev vs. X11

Martin Kelly martin at martingkelly.com
Wed Apr 23 05:35:12 CEST 2014


>
> Technically all code is throw-away code from that perspective (except
> maybe win32 API code), even as an example with GTK4 planned, writing
> GTK3 code is already not future-proof as it will be deprecated closer to
> GTK4 (much of it already is). That being said, I'd wager X(lib) will
> still be available in one form or another for far longer than GTK3, GTK4
> and Udev combined :)
>
> Note: I have no opinion on whether patches should be accepted, other
> than maybe to ask why Gudev over libudev directly since it's quite easy
> and provides a "GLIB-like" API already without an additional (small)
> depenency.
>

Seeing as I just wrote a pure udev version of the patch followed by a 
gudev version, the reason for gudev is that it abstracts for you a 
number of the details you'd normally have to deal with when using udev 
directly. For example, to listen for udev events, you would need to fork 
a listener thread, which means you'd have to handle memory management, 
thread exit, zombie collection, etc. With gudev, you just register a 
callback and all the threading is taken care of for you. In addition, 
gudev gives you a nicer uevent object to work with, which is easier to 
query and requires fewer lines of code to get the right info out of it.


More information about the Xfce4-dev mailing list