inotify: don't assume mainloop is running
authorRyan Lortie <desrt@desrt.ca>
Thu, 25 Jul 2013 14:28:42 +0000 (10:28 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 28 Jul 2013 21:19:38 +0000 (17:19 -0400)
commitabbb22573813405215c11bff9fb6b110880fd711
tree1dae47351c507b93313b8a3f3a8a7af382d96a71
parent5843582604c9b1b0d459dc7f15182c966d112d9e
inotify: don't assume mainloop is running

GFileMonitor takes great care to sample the thread-default main context
at the time that it is created in order that events can be dispatched to
the correct thread when they come in.

The inotify GFileMonitor implementation uses a global file descriptor
shared between all watches.  It has to poll this file descriptor from
somewhere so it arbitrarily picks the default main context.

The problem with that is that the user might not be running it.

Let's use the GLib worker thread for this instead.  It's guaranteed to
be running if you need it, and this is exactly the sort of problem it
was meant to solve.

https://bugzilla.gnome.org/show_bug.cgi?id=704873
gio/inotify/inotify-kernel.c
gio/inotify/inotify-missing.c