Ross Paterson ross at
Fri Sep 27 10:13:07 EDT 2002

On Fri, Sep 27, 2002 at 12:25:31PM +0100, Simon Marlow wrote:
> Then I'll reformulate my question as a patch.  Enclosed is a
> proof-of-concept patch that implements Haskell finalizers in Hugs, which
> works on some simple tests that I've run.  There's nothing particularly
> clever going on - I'm just suspending execution of the finalizers until
> the next call to eval().

It seems to have problems if more than one finalizer is pending, probably
because runIO() calls eval():

t = do
        sequence_ (map f [1..30]) 
  where f n = do
          p <- mallocBytes 64
          newForeignPtr p $ do
                free p
                putStrLn ("finalize " ++ show n) 

More information about the FFI mailing list