Re: Introducing a kqueue backend for GIO (GSoC)



Hi,

Le 22/06/2011 01:42, Dan Winship a écrit :
> On 06/19/2011 04:25 PM, Dmitry Matveev wrote:
>> My project includes writing a kqueue file monitoring backend for GIO, in
>> order to provide fast file monitoring to Glib/GIO-powered applications
>> on BSD systems.
> 
> Cool. I took a quick look. It mostly looks good. (Or at least, as good
> as the inotify backend, which is pretty ugly in places :)

I did the same yesterday just for the sake of it, and have a few
additional remarks:

>     - "initialized" in _kh_startup() needs to be volatile or it's not
>       guaranteed to behave the way you want...

Yes, and as far as I understand the code correctly, I think the use of
g_once_init_enter/leave() would be better appropriate here than the
plain lock and "initialized" var.

>       The use of a "g_" prefix on static/global variables seems very
>       wrong to me (especially in files where nothing else is
>       g-prefixed).

Same here.

Also there is G_N_ELEMENTS() for calculating the size of a static array
(e.g. in convert_kqueue_events_to_gio()).

Finally, I think the implementation of convert_kqueue_events_to_gio() is
a bit overkill for what it really does, and would probably be cheaper
with a simple if() list. It's about 4 ifs, it's not like there were
plenty of them.  But that's not important, and the compiler maybe even
optimizes this out to get rid of the static array and the loop.

Regards,
Colomban


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]