[Haskell-cafe] FFI woes!

Udo Stenzel u.stenzel at web.de
Thu Dec 16 08:06:17 EST 2004

Robert Dockins <robdockins at fastmail.fm> schrieb am 16.12.04 14:56:49:

> This is exactly the guarantee you _don't_ have.  The only guarantee you 
> have is that it _won't_ be run if the Ptr _is_ being referenced.

>From the GHC library documentation:

    newForeignPtr :: FinalizerPtr a -> Ptr a -> IO (ForeignPtr a)
    [...] The only guarantee is that the finaliser runs before the program terminates.

So it seems, finalization *is* guaranteed, just not promptness of finalization.

> My concern is that this approach is a little too non-deterministic. 
> Because playing sound involves HW resources, [...]

If I understand correctly, the OP is dealing with library resources (mainly
memory) while the library is managing the hardware ressources.


Mit WEB.DE FreePhone mit hoechster Qualitaet ab 0 Ct./Min.
weltweit telefonieren! http://freephone.web.de/?mc=021201

More information about the Haskell-Cafe mailing list