unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* gfile-based file notifications are not immediate
@ 2014-10-25 20:17 Dima Kogan
  2014-10-26  7:55 ` Michael Albinus
                   ` (2 more replies)
  0 siblings, 3 replies; 34+ messages in thread
From: Dima Kogan @ 2014-10-25 20:17 UTC (permalink / raw)
  To: emacs-devel

Hi.

In the last few days I started several threads about various details of
file notification and auto-revert behavior. This one is about some
incorrect behavior of notifications using the 'gfile' (gio from glib)
backend.

As in the inotify thread, I set up a simple test. I built emacs using

 ./configure --with-file-notification=inotify

I then ran

 ./emacs --eval "`cat  /tmp/tstnotify.el`" -Q -nw

with tstnotify.el being

 (progn
   (require 'filenotify)

   (dolist (fil '("/tmp/tst1" "/tmp/tst2"))
     (file-notify-add-watch fil  '(change attribute-change)
                            (lambda (event)
                              (message "notify event %s" event)))
     (find-file fil))
   (switch-to-buffer "*Messages*"))


Here I ask for notifications for two files, and print out the events as
they come in. While emacs is running this way, I modify those two files
using an external tool. I would expect to see modification events for
both of these files, as soon as these modifications happen. Instead, the
notifications come in either 30 seconds later, or whenever anything goes
through emacs's input queue. So the notification is greatly delayed if
the user is not touching their emacs.

The reason is that when emacs is idle, it's blocking in the pselect()
call in xg_select() in process.c. pselect() is an operating-system call,
not a glib one. Later on in xg_select() there's some code to kick the
glib event loop, but as long as we're sitting in the pselect(), that
secondary event loop remains untouched.

Even if you kick the event loop in time, the notification is still
delayed a few seconds (I verified this with some test code, outside of
emacs; can post if anybody wants it). THIS is a separate issue that is
likely a bug in glib. On Linux it uses inotify internally, so if one was
using Linux, would there be any reason to use this notification scheme
instead of using inotify directly? Are there OSs where emacs supports
notifications ONLY through glib?

Once again, I'm not posting to the bug tracker yet.

dima



^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2014-11-02 15:50 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-25 20:17 gfile-based file notifications are not immediate Dima Kogan
2014-10-26  7:55 ` Michael Albinus
2014-10-26 13:12   ` Ken Brown
2014-10-28 21:33   ` Rüdiger Sonderfeld
2014-10-29  1:06     ` Stefan Monnier
2014-10-29  2:23       ` Dima Kogan
2014-10-29  3:54         ` Stefan Monnier
2014-10-29 12:03           ` Michael Albinus
2014-10-29 13:56             ` Stefan Monnier
2014-10-29 14:11               ` Óscar Fuentes
2014-10-29 15:29                 ` Stefan Monnier
2014-10-29 16:28               ` Michael Albinus
2014-10-29 20:34                 ` Stefan Monnier
2014-10-30 15:16               ` Perry E. Metzger
2014-10-30 16:51                 ` Stefan Monnier
2014-10-30 17:10                   ` Perry E. Metzger
2014-10-30 17:40                     ` Michael Albinus
2014-10-30 18:04                       ` Perry E. Metzger
2014-10-30 18:06                       ` Stefan Monnier
2014-10-30 18:11                         ` Michael Albinus
2014-10-30 19:21                           ` Perry E. Metzger
2014-10-30 19:39                             ` Dima Kogan
2014-10-30 19:27                           ` Stefan Monnier
2014-10-29 14:00             ` Wolfgang Jenkner
2014-10-30 19:12               ` Wolfgang Jenkner
2014-10-30 20:32               ` Rüdiger Sonderfeld
2014-10-31 21:28                 ` Perry E. Metzger
2014-11-02 14:15                   ` Noam Postavsky
2014-11-02 15:50                     ` Perry E. Metzger
2014-10-26 16:02 ` Eli Zaretskii
2014-10-26 17:07   ` Dima Kogan
2014-10-26 17:14     ` Eli Zaretskii
2014-10-26 16:41 ` Michael Albinus
2014-10-28  0:32   ` Dima Kogan

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).