The Revenge of Finalizers
Alastair Reid
alastair at reid-consulting-uk.ltd.uk
Thu Oct 17 08:07:32 EDT 2002
Alastair:
> > I don't know how to achieve the same goal with atomicModifyIORef.
George:
> 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
conditions.
In particular, if ioRef1 is updated by a lazy function, then the write
to ioRef1 happens but the write to ioRef2 does not.
--
Alastair
More information about the FFI
mailing list