MLton.RUsage.ru

Henry Cejtin henry@sourcelight.com
Mon, 25 Jun 2001 21:04:01 -0500


In  most C code, establishing a critical section has a sufficiently high cost
that it will dominate in the case of just copying a few values.   This  might
not  be  the  case for MLton, but you still have to, at the minimum, set some
global to enter the critical section and clear  some  global,  probably  also
doing  a test to see if there was an interrupt, on exit.  I guess I don't see
the advantage.  Given that the types are all int's here, you  can  just  call
MLton.RUsage.ru  with  an array of ints as an argument.  There is no escaping
that a copy has to happen from the C structure to the MLton one.  This way it
is written in MLton, and is very clean.

As to the threads, I always worry about later finding all the places where an
assumption was made  about  things  like  basic  blocks  being  automatically
atomic.