Finalizers etcetera

Alastair Reid alastair at
Fri Oct 11 10:55:21 EDT 2002

> Thus it seems sensible for the FFI to say:

>   (1) do not manipulate shared state in a finaliser unless your host
> system implements concurrency; (2) if you do manipulate shared state
> in a finaliser, then you must use the model for mutual exclusion
> provided by the host system (e.g. MVars, or storing the shared state
> in the foreign language only).

I think this kind of specification spells disaster for portability.
We'll see lots of code that works for GHC, crashes occasionally on
Hugs and doesn't compile or crashes occasionally with NHC.  The
crashes will be hard to repeat and a nightmare to debug.

The 'crashes occasionally with NHC' is because I suspect that some of
NHC's libraries contain some state and that NHC doesn't document that
these libraries contain race conditions which show up in the presence
of concurrency.


More information about the FFI mailing list