aboutsummaryrefslogtreecommitdiff
path: root/Utility/DirWatcher.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-06-19 02:23:45 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-06-19 02:23:45 -0400
commit4ab9449cee0cb1377a768b44fe832282ac1f88b9 (patch)
treebe31b9413f1f8f938890fc8006cc833ae51ea9d0 /Utility/DirWatcher.hs
parentfd3e94593224fe0e656c7bb1dc117db057575f4e (diff)
add eventsCoalesce
Diffstat (limited to 'Utility/DirWatcher.hs')
-rw-r--r--Utility/DirWatcher.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/Utility/DirWatcher.hs b/Utility/DirWatcher.hs
index 575036190..bf184ff8a 100644
--- a/Utility/DirWatcher.hs
+++ b/Utility/DirWatcher.hs
@@ -35,6 +35,24 @@ canWatch = True
canWatch = False
#endif
+/* With inotify, discrete events will be received when making multiple changes
+ * to the same filename. For example, adding it, deleting it, and adding it
+ * again will be three events.
+ *
+ * OTOH, with kqueue, often only one event is received, indicating the most
+ * recent state of the file.
+ */
+eventsCoalesce :: Bool
+#if WITH_INOTIFY
+eventsCoalesce = False
+#else
+#if WITH_KQUEUE
+eventsCoalesce = True
+#else
+eventsCoalesce = undefined
+#endif
+#endif
+
#if WITH_INOTIFY
watchDir :: FilePath -> Pruner -> WatchHooks -> (IO () -> IO ()) -> IO ()
watchDir dir prune hooks runstartup = INotify.withINotify $ \i -> do