
10 Jun
2004
10 Jun
'04
6:46 a.m.
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