mirror of
https://code.sup39.dev/repos/Wqawg
synced 2024-12-29 00:44:52 +09:00
Fix instance mutex deadlock, accidentally initialized the MVar empty
This commit is contained in:
parent
37216d9045
commit
468202cf45
1 changed files with 2 additions and 2 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue