Fix instance mutex deadlock, accidentally initialized the MVar empty

This commit is contained in:
fr33domlover 2019-03-09 15:43:30 +00:00
parent 37216d9045
commit 468202cf45

View file

@ -28,7 +28,7 @@ where
import Prelude
import Control.Concurrent.MVar (MVar, newEmptyMVar)
import Control.Concurrent.MVar (MVar, newMVar)
import Control.Concurrent.STM.TVar
import Control.Monad
import Control.Monad.STM
@ -93,7 +93,7 @@ withHostLock host action = do
case existing of
Just v -> return v
Nothing -> do
v <- newEmptyMVar
v <- newMVar ()
atomically $ stateTVar tvar $ \ m ->
case M.lookup host m of
Just v' -> (v', m)