X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=ocaml%2Fguestfs_c_actions.c;h=615d209ecce22ab7595123b1fda9b96867a5bc39;hp=73dfdd9f7b0156851b4dbd1c3bdb485b3b8a8da4;hb=b6adf09c4d2cc3f1d0285950c151b1fd7688ec67;hpb=2ef06eacc2be08b0268c98a4d157176aff9356e0 diff --git a/ocaml/guestfs_c_actions.c b/ocaml/guestfs_c_actions.c index 73dfdd9..615d209 100644 --- a/ocaml/guestfs_c_actions.c +++ b/ocaml/guestfs_c_actions.c @@ -4151,3 +4151,26 @@ ocaml_guestfs_e2fsck_f (value gv, value devicev) CAMLreturn (rv); } +CAMLprim value +ocaml_guestfs_sleep (value gv, value secsv) +{ + CAMLparam2 (gv, secsv); + CAMLlocal1 (rv); + + guestfs_h *g = Guestfs_val (gv); + if (g == NULL) + caml_failwith ("sleep: used handle after closing it"); + + int secs = Int_val (secsv); + int r; + + caml_enter_blocking_section (); + r = guestfs_sleep (g, secs); + caml_leave_blocking_section (); + if (r == -1) + ocaml_guestfs_raise_error (g, "sleep"); + + rv = Val_unit; + CAMLreturn (rv); +} +