Running a "final" finaliser

Simon Marlow simonmar at
Mon Jan 5 15:14:33 EST 2004

> The other complication I can see is that ForeignPtr finalisers can't
> be Haskell. So I have to call the Haskell finalisation from C.
> Is that safe? I'm afraid I still don't fully understand why Haskell
> finalisers are unsafe or why (if) calling Haskell from a C finaliser
> (which then called C land again) would be any safer. 

If you don't mind your code being non-portable, then Foreign.Concurrent
provides Haskell finalisers.  This support will be available only on
Haskell implementations which implement pre-emptive concurrency (i.e.
just GHC for now).


More information about the Glasgow-haskell-users mailing list