[Libguestfs] [PATCH] generator: c.ml - wrap non deamon function with recursive mutex

Richard W.M. Jones rjones at redhat.com
Fri May 16 15:44:41 UTC 2014


On Thu, May 15, 2014 at 05:39:08PM +0200, mzatko at redhat.com wrote:
> +
> +  pr "gl_recursive_lock_define_initialized(static, global_lock)\n";

static?

I suspect this only allows one libguestfs handle per process into the
critical section at once.  I think the lock needs to be per-handle
unless I'm misunderstanding what this is for.

Rich.

> +  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
> 
> _______________________________________________
> Libguestfs mailing list
> Libguestfs at redhat.com
> https://www.redhat.com/mailman/listinfo/libguestfs

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html




More information about the Libguestfs mailing list