[MLton-commit] r6617

Matthew Fluet fluet at mlton.org
Sat May 10 04:43:01 PDT 2008


Archive yet another implementation of isolate.

----------------------------------------------------------------------

U   mlton/trunk/basis-library/mlton/cont.sml

----------------------------------------------------------------------

Modified: mlton/trunk/basis-library/mlton/cont.sml
===================================================================
--- mlton/trunk/basis-library/mlton/cont.sml	2008-05-10 11:42:52 UTC (rev 6616)
+++ mlton/trunk/basis-library/mlton/cont.sml	2008-05-10 11:42:56 UTC (rev 6617)
@@ -101,4 +101,15 @@
    end
 end
 
+val isolate: ('a -> unit) -> 'a t =
+   fn (f: 'a -> unit) =>
+   fn (v: unit -> 'a) =>
+   let
+      val th = (f (v ()) ; Exit.topLevelSuffix ())
+               handle exn => MLtonExn.topLevelHandler exn
+      val t = MLtonThread.prepare (MLtonThread.new th, ())
+   in
+      MLtonThread.switch (fn _ => t)
+   end
+
 end




More information about the MLton-commit mailing list