From 5580af5789427fc5fd7cd74fd4a2529668621a68 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 19 Jun 2012 10:22:36 -0400 Subject: add closingTracked flag --- Utility/DirWatcher.hs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'Utility/DirWatcher.hs') diff --git a/Utility/DirWatcher.hs b/Utility/DirWatcher.hs index bf184ff8a..baab244c7 100644 --- a/Utility/DirWatcher.hs +++ b/Utility/DirWatcher.hs @@ -53,6 +53,25 @@ eventsCoalesce = undefined #endif #endif +/* With inotify, file closing is tracked to some extent, so an add event + * will always be received for a file once its writer closes it, and + * (typically) not before. This may mean multiple add events for the same file. + * + * OTOH, with kqueue, add events will often be received while a file is + * still being written to, and then no add event will be received once the + * writer closes it. + */ +closingTracked :: Bool +#if WITH_INOTIFY +closingTracked = True +#else +#if WITH_KQUEUE +closingTracked = False +#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