addForeignPtrFinalizer - finalizers run in FIFO or LIFO order?
Henning Thielemann
lemming at henning-thielemann.de
Fri Aug 17 14:10:02 CEST 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