addForeignPtrFinalizer - finalizers run in FIFO or LIFO order?

Edward Z. Yang ezyang at MIT.EDU
Fri Aug 17 22:06:44 CEST 2012


No. 1 question: do you have a reproduceable test case of both behaviors?

Edward

Excerpts from Henning Thielemann's message of Fri Aug 17 08:10:02 -0400 2012:
> 
> The doc of base-4.5:Foreign.ForeignPtr.addForeignPtrFinalizer states:
>     "This function adds a finalizer to the given foreign object. The 
> finalizer will run before all other finalizers for the same object which 
> have already been registered."
> 
> 
> I do
> 
>    addForeignPtrFinalizer finalize1 fp
>    addForeignPtrFinalizer finalize2 fp
> 
> and let the finalizers print something when they are started.
> I get the output:
> 
>    finalizer1
>    finalizer2
> 
> This indicates that the newly added finalizer is run _after_ the 
> finalizers that are already registered. Is this a documentation bug or a 
> bug in the base library?
> 



More information about the FFI mailing list