emacs-devel
[Top][All Lists]
Advanced

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

Re: Clarification about auto-revert-mode and inotify


From: Dima Kogan
Subject: Re: Clarification about auto-revert-mode and inotify
Date: Tue, 21 Oct 2014 12:39:47 -0700

Eli Zaretskii <address@hidden> writes:

>> From: Dima Kogan <address@hidden>
>> Cc: address@hidden, address@hidden
>> Date: Tue, 21 Oct 2014 11:59:00 -0700
>> 
>> The issue I'm trying to solve is that there's a delay between when a
>> file is modified and when auto-revert-mode kicks in.
>
> A "delay" of, say, 0.01 seconds is indistinguishable from zero.

OK. Maybe I'm not understanding something then. If I set the delay in
the current code to 0.01 seconds, then isn't emacs polling its flag 100
times a second? I recognize that it's not looking at the file system
itself, but rather at the flag set by inotify, but this is still work
that does not need to be done.

If we have inotify telling us when files are updated, then we don't NEED
to poll anything. This is in fact the whole point of inotify.

The prototype patch I attached earlier reacts to inotify events as soon
as they happen, with some throttling, so if a file is updated every 10
seconds, say, then you'll get each update immediately with no polling.

If a file is updated every 0.1 seconds, however, then you'll get the
first update immediately, and the others with a period of 1 second. The
current code set to poll every 0.01 seconds would not only do stuff
every 0.01 seconds, but it'll also actually revert the buffer every 0.1
seconds, which is potentially inefficient.

The bulk of my patch is the throttling logic. If I take that out, then
the patch is one added line.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]