summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-06-19 10:22:36 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-06-19 10:22:36 -0400
commit5580af5789427fc5fd7cd74fd4a2529668621a68 (patch)
treedb43107ef3316579bc6d32908ba61654d8d0cbbb
parente68b3c99f44a00cb6e5c405115746b6bbad1e2cc (diff)
add closingTracked flag
-rw-r--r--Utility/DirWatcher.hs19
1 files changed, 19 insertions, 0 deletions
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