Finalizers etcetera

Ross Paterson ross at soi.city.ac.uk
Wed Oct 9 13:09:37 EDT 2002


On Wed, Oct 09, 2002 at 04:09:07PM +0100, Alastair Reid wrote:
> > What hasn't been required is for the various data structures to be
> > in a consistent state at that point, and Haskell finalizers might
> > trip over those if run after GC.  SimonM's patch ran them at a
> > different point, though.
> 
> It calls them in eval doesn't it?
> eval is called by nearly every primitive in Hugs.
> Most calls are benign since the calls are at the start of the primop
> before any data structures have been fiddled with.
> 
> It's even possible that none have any problems.  All I'm saying that
> we will have to look over the code before we know if there is a
> problem (while others are claiming that there couldn't possibly be a
> problem).

OK, so the problem is to find a place in Hugs that is passed frequently
enough, but at which the internal data structures are consistent.

How about the start of primPass (called to enter the continuation
argument of >>= in the IO monad)?  Seems like a safe place to do an
IO action.  (I don't know why the IO furniture is primitive, but since
it's there ...)  The top-level loop is presumably another safe place.



More information about the FFI mailing list