next up previous contents
Next: SMLofNJ: SML_OF_NJ Up: MLton Previous: MLton.Word, MLton.Word8   Contents


MLton.World

signature MLTON_WORLD =
   sig
      datatype status = Clone | Original

      val load: string -> 'a
      val save: string -> status
      val saveThread: string * unit Thread.t -> status
   end

datatype status

used to specify whether a world is original or a restarted (a clone).

load f

load the saved computation from file f.

save f

save the entire state of the computation to the file f. The computation can then be restarted at a later time using World.load or the load-world runtime system option. The call to save in the original computation returns Original and the call in the restarted world returns Clone. The following example is a transcript run in the examples/save-world directory.
% mlton save-world.sml
% save-world
I am the original
% save-world @MLton load-world world --
I am the clone

saveThread (f, t)

save the entire state of the computation to the file f, and resume with thread t upon restart.