Re: PATCH: Allow updating of timer & file handle event watches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 18, 2007 at 02:56:35AM +0100, Daniel P. Berrange wrote:
> The forthcoming patch to add Avahi support requires a couple of enhancements
> to our event loop to support integration with Avahi's event callback needs
> 
>  - Ability to update the event mask for a pre-existing file handle watch
>  - Ability to change the frequency of a timer watch
>  - Ability to have a timer which fires immediately
>  - Ability to disable events on a timer watch
> 
> The first point was trivial - just change the 'events' flag we have recorded
> in the virEventHandle struct.
> 
> The second point was also trivial - just change the period of the timer as
> recorded in virEventTimer struct.
> 
> The last two points were more tricky, but doable. To fire a timer immediately
> I tweaked the logic so that it allows a frequency of '0'. Obviously to avoid
> spinning 100%, the app should unregister the timer once it has fired the
> desired number of times (usually 1). To disable a timer temporarily I allow
> the use of '-1' in the frequency.
> 
> THe code had a bad mix of terminology using a 'timer' and 'timeout' field
> in the virEventTimer struct which confused me no end. So I renamed the
> 'timeout' field to 'frequency' which reflects its actual purpose.
> 
> Finally, when building with debugging, the event loop can generate alot of
> data, so I added a EVENT_DEBUG macro to the file which prefixes EVENT: on
> all debug output so allow easy filtering.

  Looks fine to me +1
  From a stylistic POV I notice the function comment description is in the
header files, not in the C file like others parts of libvirt, as long as 
one doesn't forget to update them when updating the code, that's fine.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard@xxxxxxxxxx  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]