ocaml: Replace old enter/leave_blocking_section calls

Since OCaml 4 the old and confusing caml_enter_blocking_section and
caml_leave_blocking_section calls have been replaced with
caml_release_runtime_system and caml_acquire_runtime_system (in that
order).  Use the new names.
This commit is contained in:
Richard W.M. Jones
2023-06-27 10:17:58 +01:00
parent 1274452d22
commit 7e1d7c1330
2 changed files with 6 additions and 4 deletions

View File

@@ -429,6 +429,7 @@ and generate_ocaml_c () =
#include <caml/memory.h>
#include <caml/mlvalues.h>
#include <caml/signals.h>
#include <caml/threads.h>
#include <guestfs.h>
#include \"guestfs-utils.h\"
@@ -689,12 +690,12 @@ copy_table (char * const * argv)
pr "\n";
if blocking then
pr " caml_enter_blocking_section ();\n";
pr " caml_release_runtime_system ();\n";
pr " r = %s " c_function;
generate_c_call_args ~handle:"g" style;
pr ";\n";
if blocking then
pr " caml_leave_blocking_section ();\n";
pr " caml_acquire_runtime_system ();\n";
(* Free strings if we copied them above. *)
List.iter (

View File

@@ -34,6 +34,7 @@
#include <caml/mlvalues.h>
#include <caml/printexc.h>
#include <caml/signals.h>
#include <caml/threads.h>
#include <caml/unixsupport.h>
#include "guestfs-c.h"
@@ -395,12 +396,12 @@ event_callback_wrapper (guestfs_h *g,
/* Ensure we are holding the GC lock before any GC operations are
* possible. (RHBZ#725824)
*/
caml_leave_blocking_section ();
caml_acquire_runtime_system ();
event_callback_wrapper_locked (g, data, event, event_handle, flags,
buf, buf_len, array, array_len);
caml_enter_blocking_section ();
caml_release_runtime_system ();
}
value