[Libguestfs] GObject bindings overview

Matthew Booth mbooth at redhat.com
Fri Jan 20 14:28:10 UTC 2012


On 01/20/2012 02:24 PM, 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.
>
> But can we add GCancellable to everything?

You can certainly add it as an argument. We can ignore it entirely if 
the api isn't actually cancellable. It's a bit ugly, though.

Matt
-- 
Matthew Booth, RHCA, RHCSS
Red Hat Engineering, Virtualisation Team

GPG ID:  D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490




More information about the Libguestfs mailing list