Skip to content

Commit e210eae

Browse files
committed
Merge pull request #1 from liamoc/patch-1
Fix deadlock
2 parents 37146df + 03583a9 commit e210eae

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Control/Memoization/Utils.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ memoize action = do
2222
return $ \arg -> do
2323
m <- takeMVar mm
2424
case Map.lookup arg m of
25-
Just ret -> return ret
25+
Just ret -> do
26+
putMVar mm m
27+
return ret
2628
Nothing -> do
2729
ret <- action arg
2830
putMVar mm (Map.insert arg ret m)

0 commit comments

Comments
 (0)