Finalizers and FFI
Gracjan Polak
gracjan at student.uci.agh.edu.pl
Thu Jun 10 06:46:53 EDT 2004
Alastair Reid wrote:
>
> You could give the finalizer thread a chance to run by calling
> Control.Concurrent.yield before exiting:
>
Thanks, it worked. This is ok for me, because my finalizer only closes
some handles. Those are closed at program end anyway, so in this case I
can live with it.
BUT: This can make some people unhappy. Isn't there a more deterministic
way to schedule finalizers? I've read about MVars etc, but this seems
like an ugly hack around GC deficiency.
Do weak references have same problem?
Also documentation about newForeignPtr (in Control.Concurrent and in
Foreign.ForeignPtr) is lying: "The only guarantee is that the finaliser
runs before the program terminates." Currently there is no guarantee :)
--
Gracjan
More information about the Glasgow-haskell-users
mailing list