[MLton] Re: Real*.gdtoa not thread safe
Henry Cejtin
henry.cejtin at sbcglobal.net
Fri Aug 25 09:25:11 PDT 2006
I checked in a fix to Real*.toManExp, split and gdtoa so that they are thread
safe (just using the One structure).
It really is sad to have to worry about this kind of stuff, and I am sure
that there must be many other places where this needs to be done.
I tested things and I couldn't perceive any slow down, but in more light-
weight cases, we could make One.use REALLY cheap by avoiding the
Primitive.Thread.atomic{Begin, End} by having the following test-and-set kind
of primitive:
val fetchAndUpdate: 'a ref * 'a -> 'a
which atomically fetches the old contents and stores the provided value,
returning the old value.
The point is that (I am pretty sure) that that code would be `atomic' because
there are no safe points in it any way.
More information about the MLton
mailing list