@@ -15,12 +15,16 @@ module Development.IDE.Graph.Internal.Action
1515, getKeysAndVisitedAge
1616, isAsyncException
1717, pumpActionThread
18+ , pumpActionThreadReRun
19+ , sequenceRun
20+ , seqRunActions
1821) where
1922
2023import Control.Concurrent.Async
2124import Control.Concurrent.STM.Stats (atomicallyNamed )
2225import Control.DeepSeq (force )
2326import Control.Exception
27+ import Control.Monad (void )
2428import Control.Monad.IO.Class
2529import Control.Monad.RWS (MonadReader (ask ),
2630 asks )
@@ -77,6 +81,20 @@ parallel xs = do
7781-- getAction d
7882-- liftIO $ atomically $ doneQueue d actionQueue
7983
84+ -- pumpActionThread1 :: ShakeDatabase -> Action ()
85+ pumpActionThreadReRun :: ShakeDatabase -> DelayedAction () -> Action ()
86+ pumpActionThreadReRun (ShakeDatabase _ _ db) d = do
87+ a <- ask
88+ s <- atomically $ getDataBaseStepInt db
89+ liftIO $ runInThreadStmInNewThreads db
90+ (return $ DeliverStatus s (actionName d) key)
91+ (ignoreState a $ runOne d) (const $ return () )
92+ where
93+ key = (newDirectKey $ fromJust $ hashUnique <$> uniqueID d)
94+ runOne d = setActionKey key $ do
95+ _ <- getAction d
96+ liftIO $ atomically $ doneQueue d (databaseActionQueue db)
97+
8098pumpActionThread :: ShakeDatabase -> (String -> IO () ) -> Action b
8199pumpActionThread sdb@ (ShakeDatabase _ _ db) logMsg = do
82100 do
@@ -177,7 +195,18 @@ runActions pk db xs = do
177195 deps <- newIORef mempty
178196 runActionMonad (parallel xs) $ SAction pk db deps emptyStack
179197
180- -- | Returns the set of dirty keys annotated with their age (in # of builds)
198+ seqRunActions :: Key -> Database -> [Action a ] -> IO ()
199+ seqRunActions pk db xs = do
200+ deps <- newIORef mempty
201+ runActionMonad (sequenceRun xs) $ SAction pk db deps emptyStack
202+
203+ sequenceRun :: [Action a ] -> Action ()
204+ sequenceRun [] = return ()
205+ sequenceRun (x: xs) = do
206+ void x
207+ sequenceRun xs
208+
209+ -- | Returns the set of dirty keys annotated with their age
181210getDirtySet :: Action [(Key , Int )]
182211getDirtySet = do
183212 db <- getDatabase
0 commit comments