[Libguestfs] [PATCH] library: per-handle locking support

Richard W.M. Jones rjones at redhat.com
Thu May 29 11:04:39 UTC 2014


On Thu, May 29, 2014 at 12:21:39PM +0200, Maros Zatko wrote:
> Introduces private pool of muteces (per_handle_locks) guarded by read-write
> mutex (locks_lock) using guestfs__per_handle_lock_lock(g) and
> guestfs__per_handle_lock_unlock(g), where g is current valid guestfs_h handle.
> Above two are used in generator/c.ml at begin and end of each non-deamon call.
> 
> New lock can be created using guestfs__per_handle_lock_add(g) and
> destroyed with guestfs__per_handle_lock_remove(g). These two are called
> automatically too. First one is called by guestfs_create and second by
> guestfs_destroy.

I'm a bit confused about why there is a pool of locks.  Why not keep
the lock struct in the handle (guestfs_h)?

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list