[libvirt] [PATCH 1/2] virObjectUnref: Set pointer to NULL on dispose

Daniel P. Berrange berrange at redhat.com
Fri Nov 8 05:27:28 UTC 2013


On Thu, Nov 07, 2013 at 11:39:27AM +0100, Michal Privoznik wrote:
> Similarly to VIR_FREE() we can set the pointer passed to virObjectUnref
> to NULL in case of disposing the object. However, to avoid overwriting
> nearly thousands line of code, the virObjectUnref is turned into a macro
> which passes the address of pointer and calls virObjectUnrefInternal
> (the modified version of original virObjectUnref).

I have to say I'm not really liking this, and your impl is not race
free since you're not atomically updating the point.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list