[Libguestfs] GObject bindings overview

Daniel P. Berrange berrange at redhat.com
Fri Jan 20 14:27:09 UTC 2012


On Fri, Jan 20, 2012 at 02:24:33PM +0000, Richard W.M. Jones wrote:
> On Fri, Jan 20, 2012 at 02:14:34PM +0000, Daniel P. Berrange wrote:
> > > Cancellation:
> > > *************
> > > 
> > > Certain apis are cancellable. These all take a GCancellable as the
> > > final argument before GError **. This can be passed NULL if
> > > cancellation is not required. While I have written cancellation, I
> > > have not yet tested it *at all* other than it compiles and works
> > > correctly when NULL is passed in.
> > > 
> > > We recently made Cancellable an explicit flag whereas before it was
> > > implicit if the api had a FileIn or FileOut argument. This means it
> > > is now possible to break the GObject api without breaking the C api
> > > with the addition of a Cancellable flag. What potential solutions
> > > are there to this problem? I can see:
> > > 
> > > • Live with breaking the GObject api if it ever comes up.
> > > • Never add Cancellable to an existing api.
> > > • Automatically add a GCancellable argument to all GObject apis,
> > > just in case.
> > 
> > I think option 2 is the only long term viable approach. If any existing
> > APIs needs to be made cancellable, then define a new API that is the
> > same, but with the cancellable flag set.
> 
> So the concern is that the GObject ABI changes?
> 
> From my point of view I don't really care, since we only guarantee the
> (real) C ABI.

Really ? I have always assumed that all bindings are long term stable
APIs too.

> But can we add GCancellable to everything?

IMHO having an extra parameter that is never used, on every single API
will make life really tedious for developers


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 Libguestfs mailing list