Skip to content

Commit 3e4d00a

Browse files
committed
fix put the result so other threads can get the result
1 parent 0d64e02 commit 3e4d00a

File tree

1 file changed

+9
-4
lines changed
  • hls-graph/src/Development/IDE/Graph/Internal

1 file changed

+9
-4
lines changed

hls-graph/src/Development/IDE/Graph/Internal/Database.hs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import Control.Concurrent.Extra
1717
import Control.Concurrent.STM.Stats (STM, atomically,
1818
atomicallyNamed,
1919
modifyTVar', newTVarIO,
20-
readTMVar, readTVarIO)
20+
putTMVar, readTMVar,
21+
readTVarIO)
2122
import Control.Exception
2223
import Control.Monad
2324
import Control.Monad.IO.Class (MonadIO (liftIO))
@@ -119,12 +120,16 @@ builderOne ba db@Database {..} stack id = UE.mask $ \restore -> do
119120
status <- SMap.lookup id databaseValues
120121
val <-
121122
let refreshRsult s = do
122-
let act = restore $ case ba of
123+
let putResult act = do
124+
res <- act
125+
liftIO $ atomically $ putTMVar barrier res
126+
return res
127+
let act = restore $ (case ba of
123128
BuildNary ->
124129
asyncWithCleanUp $
125-
refresh db stack id s
130+
putResult $ refresh db stack id s
131+
BuildUnary -> fmap return $ putResult $ refresh db stack id s)
126132
`UE.onException` (UE.uninterruptibleMask_ $ liftIO (atomicallyNamed "builder - onException" (SMap.focus updateDirty id databaseValues)))
127-
BuildUnary -> fmap return $ refresh db stack id s
128133
-- Mark the key as running
129134
SMap.focus (updateStatus $ Running current (atomically $ readTMVar barrier) s) id databaseValues
130135
return act

0 commit comments

Comments
 (0)