[MLton] Int.fmt thread unsafe? (YUCK)

Stephen Weeks MLton@mlton.org
Thu, 9 Mar 2006 12:34:05 -0800


> Aren't the Int*.fmt functions clearly thread unsafe?

Yes.

Much of the MLton basis library is thread unsafe.  In my opinion, the
best way to build a thread-safe version of the basis is to create
a wrapper around the existing library rather changing the current
code.  That way, only threaded code has to pay the performance cost.

> (Please, it would be a big loss to make the code thread safe even
> when no threads are being used and I would hate to lose out, but the
> current code clearly seems wrong to me.)

Yes, it would cost significantly performance-wise to go to a
thread-safe version (I would be happy to be proved wrong).  I don't
agree that thread-unsafe = wrong; I view single threading (or
non-preemptive threading) as a precondition to using the library.