[libvirt] [PATCH 5/5] Extend events demo to show close callbacks in use

Daniel P. Berrange berrange at redhat.com
Fri Jul 20 14:18:56 UTC 2012


On Thu, Jul 19, 2012 at 01:12:33PM -0600, Eric Blake wrote:
> On 07/19/2012 09:04 AM, Daniel P. Berrange wrote:
> > From: "Daniel P. Berrange" <berrange at redhat.com>
> > 
> > Use a driver close callback to trigger shutdown of the
> > events demo program
> > 
> > Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> > ---
> >  examples/domain-events/events-c/event-test.c |   33 ++++++++++++++++++++++++--
> >  1 file changed, 31 insertions(+), 2 deletions(-)
> > 
> > diff --git a/examples/domain-events/events-c/event-test.c b/examples/domain-events/events-c/event-test.c
> > index ef6e77a..f2427ad 100644
> > --- a/examples/domain-events/events-c/event-test.c
> > +++ b/examples/domain-events/events-c/event-test.c
> > @@ -16,6 +16,8 @@
> >  # define ATTRIBUTE_UNUSED __attribute__((__unused__))
> >  #endif
> >  
> > +int run = 1;
> 
> bool?  Then again, <stdbool.h> isn't available everywhere, and I think
> our examples can work with C89 even though the rest of our project
> requires C99.
> 
> > @@ -380,7 +407,6 @@ void usage(const char *pname)
> >      printf("%s uri\n", pname);
> >  }
> >  
> > -int run = 1;
> 
> not to mention it was just code motion.
> 
> > @@ -426,6 +452,9 @@ int main(int argc, char **argv)
> >          return -1;
> >      }
> >  
> > +    virConnectSetCloseCallback(dconn,
> > +                               connectClose, NULL, NULL);
> 
> :) I was right - passing a NULL opaque is useful!

And pasing NULL is already allowed.

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