From: Maros Zatko <mzatko(a)redhat.com>
---
generator/c.ml | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/generator/c.ml b/generator/c.ml
index ee276dc..4333bb8 100644
--- a/generator/c.ml
+++ b/generator/c.ml
@@ -788,6 +788,9 @@ and generate_internal_actions_h () =
pr "#define GUESTFS_INTERNAL_ACTIONS_H_\n";
pr "\n";
+ pr "#include \"glthread/lock.h\"\n";
+ pr "\n";
+
List.iter (
fun { c_name = c_name; style = style } ->
generate_prototype ~single_line:true ~newline:true ~handle:"g"
@@ -796,6 +799,10 @@ and generate_internal_actions_h () =
) non_daemon_functions;
pr "\n";
+
+ pr "gl_recursive_lock_define_initialized(static, global_lock)\n";
+ pr "\n";
+
pr "#endif /* GUESTFS_INTERNAL_ACTIONS_H_ */\n"
(* Generate guestfs-internal-frontend-cleanups.h file. *)
@@ -1567,6 +1574,8 @@ and generate_client_actions hash () =
c_name style;
pr "{\n";
+ pr " gl_recursive_lock_lock (global_lock);\n";
+
handle_null_optargs optargs c_name;
pr " int trace_flag = g->trace;\n";
@@ -1617,6 +1626,9 @@ and generate_client_actions hash () =
trace_return name style "r";
);
pr "\n";
+
+ pr " gl_recursive_lock_unlock (global_lock);\n";
+
pr " return r;\n";
pr "}\n";
pr "\n"
--
1.8.5.3