(** [delete_event_callback g eh] removes a previously registered
event callback. See {!set_event_callback}. *)
+val user_cancel : t -> unit
+(** Cancel current transfer. This is safe to call from OCaml signal
+ handlers and threads. *)
+
";
generate_ocaml_structure_decls ();
method close : unit -> unit
method set_event_callback : event_callback -> event list -> event_handle
method delete_event_callback : event_handle -> unit
+ method user_cancel : unit -> unit
method ocaml_handle : t
";
external delete_event_callback : t -> event_handle -> unit
= \"ocaml_guestfs_delete_event_callback\"
+external user_cancel : t -> unit = \"ocaml_guestfs_user_cancel\" \"noalloc\"
+
(* Give the exceptions names, so they can be raised from the C code. *)
let () =
Callback.register_exception \"ocaml_guestfs_error\" (Error \"\");
method close () = close g
method set_event_callback = set_event_callback g
method delete_event_callback = delete_event_callback g
+ method user_cancel () = user_cancel g
method ocaml_handle = g
";
CAMLprim value ocaml_guestfs_close (value gv);
CAMLprim value ocaml_guestfs_set_event_callback (value gv, value closure, value events);
CAMLprim value ocaml_guestfs_delete_event_callback (value gv, value eh);
+value ocaml_guestfs_user_cancel (value gv);
/* Allocate handles and deal with finalization. */
static void
CAMLreturn0;
}
+
+/* NB: This is and must remain a "noalloc" function. */
+value
+ocaml_guestfs_user_cancel (value gv)
+{
+ guestfs_h *g = Guestfs_val (gv);
+ if (g)
+ guestfs_user_cancel (g);
+ return Val_unit;
+}