From 4ab9449cee0cb1377a768b44fe832282ac1f88b9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 19 Jun 2012 02:23:45 -0400 Subject: add eventsCoalesce --- Utility/DirWatcher.hs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 -- cgit v1.2.3