[MLton-user] SMLofNJ.Cont.isolate

Dave Herman dherman at ccs.neu.edu
Fri Apr 25 12:24:58 PDT 2008


Dave Herman (foolishly?) wrote:

> Forgive my lack of familiarity with MLton threads... do you just mean this?
> 
>     let ...
>     in
>       MLton.Thread.switch (fn _ => r);
>       OS.Process.exit ...
>     end

Maybe you meant this:

     fun isolate (f: 'a -> unit) : 'a cont =
       fn x =>
       let
         fun g () = (f x; OS.Process.exit OS.Process.success)
         val t = MLton.Thread.new g
         val r = MLton.Thread.prepare (t, ())
       in
         MLton.Thread.switch (fn _ => r)
       end

Yes?

Thanks again,
Dave



More information about the MLton-user mailing list