Re: addForeignPtrFinalizer - finalizers run in FIFO or LIFO order?
"Edward Z. Yang" <[email protected]> Fri, 17 Aug 2012 16:06:44 -0400
| Newsgroups | gmane.comp.lang.haskell.ffi,gmane.comp.lang.haskell.libraries |
|---|---|
| Message-ID | <1345233987-sup-6852@ezyang> |
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? >