The Revenge of Finalizers

Alastair Reid alastair at
Thu Oct 17 08:07:32 EDT 2002

> > I don't know how to achieve the same goal with atomicModifyIORef.
> I do.  To modify ioRef1 and ioRef2 "simultaneously", write
>   atomicModifyIORef ioRef1  (\ contents1 -> 
>      unsafePerformIO ioRef2 (\ contents2 -> 
>      blah blah))
> The actual modification will take place when the result or contents of
> ioRef1 or ioRef2 get evaluated.

I must be missing something because this seems to be riddled with race

In particular, if ioRef1 is updated by a lazy function, then the write
to ioRef1 happens but the write to ioRef2 does not.  


More information about the FFI mailing list