]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
Expose event loop implementation as a public API
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 2 Mar 2011 16:59:54 +0000 (16:59 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Mon, 7 Mar 2011 14:16:13 +0000 (14:16 +0000)
commit2ed6cc7bec41dd344d41ea1531f6760c93099128
tree950b6e40fe37ed48a452d3d74b9e17f29f50b4ac
parent343eaa150b346903e7c3d16dde732f7dd1b8365e
Expose event loop implementation as a public API

Not all applications have an existing event loop they need
to integrate with. Forcing them to implement the libvirt
event loop integration APIs is an undue burden. This just
exposes our simple poll() based implementation for apps
to use. So instead of calling

   virEventRegister(....callbacks...)

The app would call

   virEventRegisterDefaultImpl()

And then have a thread somewhere calling

    static bool quit = false;
    ....
    while (!quit)
      virEventRunDefaultImpl()

* daemon/libvirtd.c, tools/console.c,
  tools/virsh.c: Convert to public event loop APIs
* include/libvirt/libvirt.h.in, src/libvirt_private.syms: Add
  virEventRegisterDefaultImpl and virEventRunDefaultImpl
* src/util/event.c: Implement virEventRegisterDefaultImpl
  and virEventRunDefaultImpl using poll() event loop
* src/util/event_poll.c: Add full error reporting
* src/util/virterror.c, include/libvirt/virterror.h: Add
  VIR_FROM_EVENTS
daemon/libvirtd.c
include/libvirt/libvirt.h.in
include/libvirt/virterror.h
po/POTFILES.in
src/libvirt_private.syms
src/libvirt_public.syms
src/util/event.c
src/util/event_poll.c
src/util/virterror.c
tools/console.c
tools/virsh.c