on master help sign in
adding comments about mkWeakIORef.
commit8a07b99a886006a37b0f83a896b38c3d61f2f078 authorKazu Yamamoto <kazu@iij.ad.jp> dateThu 10 Oct 2013, 18:02 (13 years ago) parent07732c1
1 file changed+3
warp/Network/Wai/Handler/Warp/FdCache.hs+3
warp/Network/Wai/Handler/Warp/FdCache.hs+3
@@ -80,6 +80,9 @@ initialize :: Int -> IO MutableFdCache
8080initialize duration = do
8181 mfc <- newMutableFdCache
8282 tid <- forkIO $ loop mfc
83+ -- Registering finalizer to this IORef.
84+ -- When Warp is finished in GHCi, this IORef is GCed.
85+ -- At that time, we should close all opened file descriptors.
8386 _ <- mkWeakIORef (unMutableFdCache mfc) $ terminate mfc tid
8487 return mfc
8588 where