14 Jan 16:26
Re: HEADS UP: finalizer changes coming in GHC 6.10.2
Sigbjorn Finne <sigbjorn.finne <at> gmail.com>
2009-01-14 15:26:17 GMT
2009-01-14 15:26:17 GMT
Thanks Simon, great stuff; I like the introduction of these 'native code finalizers', they've been sorely missed at times. You don't say, but will there be a dynamic check to catch such re-entries? --sigbjorn 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 > normal. > > 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 > affected. > > Cheers, > Simon > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe <at> haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe
RSS Feed