[libvirt] PATCH: Pass a callback for freeing opaque data when registering handle/timer events

Daniel Berrange berrange at redhat.com
Wed Nov 19 17:00:27 UTC 2008

On Wed, Nov 19, 2008 at 02:21:40PM +0100, Daniel Veillard wrote:
> On Mon, Nov 17, 2008 at 05:02:40PM +0000, Daniel P. Berrange wrote:
> > When registering for a file descriptor event, or timer events, the event
> > callback has an associated 'void *opaque' data blob. When removing a
> > registered event, the removal may be done asynchronously to allow safe
> > removal from within a callback. This means that it is not safe for the
> > application to assume they can free the 'void *opaque' data immediately
> > after calling virEventRemoveHandle/Timer. So, we extend the AddHandle/Timer
> > method to allow a 2nd callback to be provided. This callback is used to
> > free the 'void *opaque' data at the appropriate (safe) point in time.
>   okay, it makes more sense to provide the API framework on how to free
> the data

I've committed this change, but using the generic virFreeCallback
typedef, instead of my custom one. Also I put the virFreeCallback as
the last arg, to match the style of David Lively's equivalent patch
to the virDomainEventRegister call.

|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

More information about the libvir-list mailing list