[libvirt] [PATCH] Java bindings for domain events

David Lively dlively at virtualiron.com
Mon Nov 17 20:55:13 UTC 2008


On Fri, 2008-11-14 at 12:59 -0500, David Lively wrote:
> On Fri, 2008-11-14 at 17:09 +0000, Daniel P. Berrange wrote:
> > Or have the virConnectDomainEventRegister method take an extra parameter
> > which is a callback    void (*freefunc)(void*). libvirt would just invoke
> > that to free the opaque data chunk.
> 
> Yeah, I like this better.  The dbus(?) API allows an optional
> destructor (freefunc) to be specified for callback userdata.  So let's
> allow it to be null (in which case we obviously don't call it at remove
> time).
> 
> > I think we need a similar thing with the event loops APIs for timers
> > and file handle watches, to make it easier to free the opaque data
> > blob they have.
> 
> Sounds good too.
> 
> I can make the DomainEvent changes today / this weekend while working on
> the Java bindings (since I need them to plug the Java leak), and submit
> them on Monday (or perhaps later today, if I don't get diverted).

The attached patch implements this change (adds a "freefunc" arg to
virConnectDomainEventRegister and calls it on Deregister (or Close)).

It also modifies the event-test.c example to register a freefunc and
deregister callbacks when interrupted or terminated (to verify the
freefuncs are properly called).

Dave

-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-domain-event-cb-freefunc.patch
Type: text/x-patch
Size: 11031 bytes
Desc: 
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20081117/6c0d5999/attachment-0001.bin>


More information about the libvir-list mailing list