@@ -12,13 +12,13 @@ module Development.IDE.Graph.Database(
1212 shakeGetDirtySet ,
1313 shakeGetCleanKeys
1414 ,shakeGetBuildEdges ) where
15+ import Control.Concurrent.STM (atomically ,
16+ readTVarIO )
1517import Data.Dynamic
16- import Data.IORef (readIORef )
1718import Data.Maybe
1819import Development.IDE.Graph.Classes ()
1920import Development.IDE.Graph.Internal.Action
2021import Development.IDE.Graph.Internal.Database
21- import qualified Development.IDE.Graph.Internal.Ids as Ids
2222import Development.IDE.Graph.Internal.Options
2323import Development.IDE.Graph.Internal.Profile (writeProfile )
2424import Development.IDE.Graph.Internal.Rules
@@ -45,12 +45,12 @@ shakeRunDatabase = shakeRunDatabaseForKeys Nothing
4545-- | Returns the set of dirty keys annotated with their age (in # of builds)
4646shakeGetDirtySet :: ShakeDatabase -> IO [(Key , Int )]
4747shakeGetDirtySet (ShakeDatabase _ _ db) =
48- fmap snd <$> Development.IDE.Graph.Internal.Database. getDirtySet db
48+ Development.IDE.Graph.Internal.Database. getDirtySet db
4949
5050-- | Returns the build number
5151shakeGetBuildStep :: ShakeDatabase -> IO Int
5252shakeGetBuildStep (ShakeDatabase _ _ db) = do
53- Step s <- readIORef $ databaseStep db
53+ Step s <- readTVarIO $ databaseStep db
5454 return s
5555
5656-- Only valid if we never pull on the results, which we don't
@@ -64,7 +64,7 @@ shakeRunDatabaseForKeys
6464 -> [Action a ]
6565 -> IO ([a ], [IO () ])
6666shakeRunDatabaseForKeys keysChanged (ShakeDatabase lenAs1 as1 db) as2 = do
67- incDatabase db keysChanged
67+ atomically $ incDatabase db keysChanged
6868 as <- fmap (drop lenAs1) $ runActions db $ map unvoid as1 ++ as2
6969 return (as, [] )
7070
@@ -75,12 +75,12 @@ shakeProfileDatabase (ShakeDatabase _ _ s) file = writeProfile file s
7575-- | Returns the clean keys in the database
7676shakeGetCleanKeys :: ShakeDatabase -> IO [(Key , Result )]
7777shakeGetCleanKeys (ShakeDatabase _ _ db) = do
78- keys <- Ids. elems $ databaseValues db
78+ keys <- getDatabaseValues db
7979 return [ (k,res) | (k, Clean res) <- keys]
8080
8181-- | Returns the total count of edges in the build graph
8282shakeGetBuildEdges :: ShakeDatabase -> IO Int
8383shakeGetBuildEdges (ShakeDatabase _ _ db) = do
84- keys <- Ids. elems $ databaseValues db
84+ keys <- getDatabaseValues db
8585 let ress = mapMaybe (getResult . snd ) keys
8686 return $ sum $ map (length . getResultDepsDefault [] . resultDeps) ress
0 commit comments