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.
This commit is contained in:
Joey Hess 2015-11-04 13:45:34 -04:00
parent 30e39592b4
commit 4fd03ccd7b
Failed to extract signature
12 changed files with 125 additions and 61 deletions

33
Messages/Concurrent.hs Normal file
View file

@ -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