X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Data%2FIORef.hs;h=6a27487460e13f13dfdf9e3d9611af0384ce23f0;hb=39c721869eb55206532179f926ec947ef12b1842;hp=a6f29e7fc6dfcc00067c48194af7315d399fd1ca;hpb=6abdb1cebbb6f0f0b492ba98907056d11064bc83;p=ghc-base.git diff --git a/Data/IORef.hs b/Data/IORef.hs index a6f29e7..6a27487 100644 --- a/Data/IORef.hs +++ b/Data/IORef.hs @@ -55,7 +55,8 @@ import NHC.IOExtras #endif #if defined(__GLASGOW_HASKELL__) && !defined(__PARALLEL_HASKELL__) --- |Make a 'Weak' pointer to an 'IORef' +-- |Make a 'Weak' pointer to an 'IORef', using the second argument as a finalizer +-- to run when 'IORef' is garbage-collected mkWeakIORef :: IORef a -> IO () -> IO (Weak (IORef a)) mkWeakIORef r@(IORef (STRef r#)) f = IO $ \s -> case mkWeak# r# r f s of (# s1, w #) -> (# s1, Weak w #)