[Haskell-cafe] HEADS UP: finalizer changes coming in GHC 6.10.2
sigbjorn.finne at gmail.com
Wed Jan 14 10:26:17 EST 2009
great stuff; I like the introduction of these 'native code finalizers',
been sorely missed at times.
You don't say, but will there be a dynamic check to catch such re-entries?
On 1/14/2009 04:14, Simon Marlow wrote:
> By popular demand, GHC 6.10.2 will support finalizers that are
> actually guaranteed to run, and run promptly. There aren't any API
> changes: this happens for finalizers created using newForeignPtr as
> However, there's a catch. Previously it was possible to call back
> into Haskell from a finalizer (finalizers are C functions), by using
> foreign import "wrapper" or foreign export. According to the FFI
> spec, whether this is allowed or not is "system dependent". In GHC
> 6.10.1 and earlier it was allowed, but in 6.10.2 and later it is not.
> The reason being that C finalizers are now executed directly by the
> GC, when the runtime is not in a position to handle callbacks.
> You can still have fully-fledged Haskell finalizers if you want: we
> have Foreign.Concurrent.newForeignPtr for that purpose. But those
> finalizers are not subject to the same promptness guarantees that you
> get with C finalizers - they run in a separate thread, and are not
> guaranteed to be run at program exit.
> We'll make sure this is documented prominently in the 6.10.2 release
> notes, but I thought a heads-up would be a good idea right now as it
> turns out that there are existing libraries (e.g. LLVM) that will be
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe