[MLton-devel] finalization

Henry Cejtin henry@sourcelight.com
Fri, 9 May 2003 12:22:40 -0500


Adding  one  (simple  I  think)  primitive  to  MLton  would make the current
experimental implementation of weak's give you something very very  close  to
finalization.  The one new primitive would be
    val waitForGC: unit -> unit

Calling this function simply waits until a GC is done and then returns.

The  notion  is  that  you  spawn off a thread which simply loops calling the
above and then checking weaks, and if it sees that they are gone it runs  the
finalizer.

I  like  the  semantics  because logically finalization really does involve a
separate thread.  That is how  the  control  flow  magically  goes  from  the
mutator to running the finalizer.

Of  course  the  precise  definition  of  waitForGC  isn't  clear  with fancy
generational GCs, but I don't think that that is a big deal.


-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com

_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel