summaryrefslogtreecommitdiff
path: root/Messages/Concurrent.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-11-04 13:45:34 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-11-04 13:45:34 -0400
commit1933f8a5599f33b95811710ad10e1ed17703699d (patch)
treeacf454abe167051a7ff77a752deb6c5b9f45a758 /Messages/Concurrent.hs
parentc3a372f8f500f6b88d467af42df6332836d8dd31 (diff)
concurrent-output, first pass
Output without -Jn should be unchanged from before. With -Jn, concurrent-output is used for messages, but regions are not used yet, so it's a mess.
Diffstat (limited to 'Messages/Concurrent.hs')
-rw-r--r--Messages/Concurrent.hs33
1 files changed, 33 insertions, 0 deletions
diff --git a/Messages/Concurrent.hs b/Messages/Concurrent.hs
new file mode 100644
index 000000000..3b7b28d28
--- /dev/null
+++ b/Messages/Concurrent.hs
@@ -0,0 +1,33 @@
+{- git-annex concurrent output
+ -
+ - Copyright 2015 Joey Hess <id@joeyh.name>
+ -
+ - Licensed under the GNU GPL version 3 or higher.
+ -}
+
+{-# LANGUAGE CPP #-}
+
+module Messages.Concurrent where
+
+import Common.Annex
+import Messages.Internal
+import Types.Messages
+
+#ifdef WITH_CONCURRENTOUTPUT
+import qualified System.Console.Concurrent as Console
+#endif
+
+{- Enable concurrent output when that has been requested.
+ -
+ - This should only be run once per git-annex lifetime, with
+ - everything that might generate messages run inside it.
+ -}
+withConcurrentOutput :: Annex a -> Annex a
+#ifdef WITH_CONCURRENTOUTPUT
+withConcurrentOutput a = withOutputType go
+ where
+ go (ConcurrentOutput _) = Console.withConcurrentOutput a
+ go _ = a
+#else
+withConcurrentOutput = id
+#endif