Re: [PATCH] Simplify some redundant locking while unref'ing objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/25/2012 02:29 PM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> There is no need to hold the mutex when unref'ing
> virObject instances
> 
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---
>  src/conf/domain_conf.c | 4 +---
>  src/qemu/qemu_driver.c | 4 ++--
>  src/rpc/virnetserver.c | 3 ---
>  3 files changed, 3 insertions(+), 8 deletions(-)

ACK.

> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 4aa08d0..0514540 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -741,9 +741,7 @@ static void
>  virDomainObjListDataFree(void *payload, const void *name ATTRIBUTE_UNUSED)
>  {
>      virDomainObjPtr obj = payload;
> -    virDomainObjLock(obj);
> -    if (virObjectUnref(obj))
> -        virDomainObjUnlock(obj);
> +    virObjectUnref(obj);
>  }

We now have several of these one-liner cleanup functions.  Is it worth
making a common hash wrapper function that calls virObjectUnref on the
object, rather than having to reinvent lots of one-liners, as a followup
patch?

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]