On 6/27/23 14:33, Richard W.M. Jones wrote:
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.
---
generator/OCaml.ml | 5 +++--
ocaml/guestfs-c.c | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
Highly welcome, the inverse meaning of the old names was terrible. :)
Thanks!
Laszlo
diff --git a/generator/OCaml.ml b/generator/OCaml.ml
index 02d9ee2e91..07ccd26924 100644
--- a/generator/OCaml.ml
+++ b/generator/OCaml.ml
@@ -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 (
diff --git a/ocaml/guestfs-c.c b/ocaml/guestfs-c.c
index 3888c94564..8c8aa46096 100644
--- a/ocaml/guestfs-c.c
+++ b/ocaml/guestfs-c.c
@@ -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