
On 01/10/2011 10:38 AM, Cole Robinson wrote:
This structure will be used to unify lots of duplicated event handling code across the state drivers.
Signed-off-by: Cole Robinson <crobinso@redhat.com> --- src/conf/domain_event.c | 91 ++++++++++++++++++++++++++++++++++++---------- src/conf/domain_event.h | 47 +++++++++++++++++------- 2 files changed, 104 insertions(+), 34 deletions(-)
Missing a tweak to the list of free-like functions in cfg.mk for virDomainEventStateFree.
+void +virDomainEventStateFree(virDomainEventStatePtr state) +{ + virDomainEventCallbackListFree(state->callbacks);
Missing an early exit for state==NULL, which is essential since virDomainEventStateNew's error: block can hit that scenario.
+ +struct _virDomainEventState { + /* The list of domain event callbacks */ + virDomainEventCallbackListPtr callbacks; + /* The queue of domain events */ + virDomainEventQueuePtr queue; + /* Timer for flushing events queue */ + int timer; + /* Flag if we're in process of dispatching */ + int isDispatching;
s/int/bool/
@@ -163,6 +177,11 @@ virDomainEventQueuePop(virDomainEventQueuePtr evtQueue);
void virDomainEventFree(virDomainEventPtr event); void virDomainEventQueueFree(virDomainEventQueuePtr queue); +void virDomainEventStateFree(virDomainEventStatePtr state); +virDomainEventStatePtr +virDomainEventStateNew(virEventTimeoutCallback timeout_cb, + void *timeout_opaque, + virFreeCallback timeout_free);
ATTRIBUTE_NONNULL(1) (the other two can reasonably be NULL, though). [Hmm, we probably are missing some other useful ATTRIBUTE_NONNULL markups throughout the event-related headers] -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org