@@ -13,7 +13,6 @@ import Control.Monad
1313import Data.Hashable
1414import Data.IORef
1515import Network.Wai.Handler.Warp.MultiMap
16−import System.Mem.Weak (addFinalizer)
1716import System.Posix.IO
1817import System.Posix.Types
1918
@@ -50,7 +49,7 @@ newFdEntry path = FdEntry path
5049
5150type Hash = Int
5251type FdCache = MMap Hash FdEntry
53−newtype MutableFdCache = MutableFdCache (IORef FdCache)
52+newtype MutableFdCache = MutableFdCache { unMutableFdCache :: IORef FdCache }
5453
5554newMutableFdCache :: IO MutableFdCache
5655newMutableFdCache = MutableFdCache <$> newIORef empty
@@ -82,7 +81,7 @@ initialize :: Int -> IO MutableFdCache
8281initialize duration = do
8382 mfc <- newMutableFdCache
8483 tid <- forkIO $ loop mfc
85− addFinalizer mfc $ terminate mfc tid
84+ _ <- mkWeakIORef (unMutableFdCache mfc) $ terminate mfc tid
8685 return mfc
8786 where
8887 loop mfc = do