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

Re: [libvirt] PATCH: 11/25: Public APIs for incrementing refcount



On Tue, Jan 13, 2009 at 05:43:08PM +0000, Daniel P. Berrange wrote:
> With the domain events code, the callbacks triggered upon events get given
> a virDomainPtr object instance. In many cases it'd be desirable to grab
> this object and keep it in your app code. Unfortunately it is free'd the
> moment the callback finishes executing.
> 
> When allowing multiple threads to access a single virConnectPtr object
> it is neccessary to ensure no thread releases it (virConnectCLose) while
> another thread is still using it.
> 
> The way to address both of these problems is to allow an application to
> take an explicit reference on the object in question. So this patch
> exposes methods to allow an app to increment the ref count on all our
> public objects. To release the ref count, the existing virConectClose/
> virDOmainFree, etc methods suffice
> 
>  include/libvirt/libvirt.h    |    6 +
>  include/libvirt/libvirt.h.in |    6 +
>  src/libvirt.c                |  183 +++++++++++++++++++++++++++++++++++++++++++
>  src/libvirt_public.syms      |   12 ++
>  4 files changed, 206 insertions(+), 1 deletion(-)

Poor man's garbage collection ... +1.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top


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