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