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

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

 



On Thu, Jan 15, 2009 at 05:18:40PM +0000, Richard W.M. Jones wrote:
> 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.

  Yeah it's unfortunate we have to add this at the API level, but
unfortunately there is no way around.
  I wonder if we could resurrect some of the deprecated fields of
error structure now, seems to me that would be possible now.

   Patch looks fine, +1

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
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]