Version française
Home     About     Download     Resources     Contact us    
Browse thread
Native delimited continuations for bytecode OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Till Varoquaux <till.varoquaux@g...>
Subject: Re: [Caml-list] Native delimited continuations for bytecode OCaml
Can your code be used for undelimited continuation? I am currently
using code that looks somewhat like this:


open Netchannels
open Marshal

let suspend ()=
  let oo=open_out "state"
  and save_state k=
    to_string k [Closures])
    (* Skips a warning because this function does not return (it is an exit
       point)*)
    ignore(exit 0)
  in
  callcc save_state
(*
  Saves the "state" the application is in as an base64 encoded marshalled
  continuation.
*)
let _ =
  if (Sys.file_exists "state") then
    let res =

    Sys.remove("state");
    let k=Marshal.from_string res 0 in
      throw k ()