[libvirt] [PATCH][libvirt-glib] glib-events: Allow zero timeouts for timer

In libvirt, it's perfectly possible and widely used to have disabled timers (timeout=-1) and fire them up 'randomly' with timeout=0. However, with current mapping into glib mainloop it's not possible and causing troubles. --- libvirt-glib/libvirt-glib-event.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libvirt-glib/libvirt-glib-event.c b/libvirt-glib/libvirt-glib-event.c index 94f4de8..c3eb3c8 100644 --- a/libvirt-glib/libvirt-glib-event.c +++ b/libvirt-glib/libvirt-glib-event.c @@ -384,7 +384,7 @@ gvir_event_timeout_update(int timer, if (interval >= 0) { if (data->source) - goto cleanup; + g_source_remove(data->source); data->interval = interval; data->source = g_timeout_add(data->interval, -- 1.7.8.5

On Fri, Jun 01, 2012 at 01:41:54PM +0200, Michal Privoznik wrote:
In libvirt, it's perfectly possible and widely used to have disabled timers (timeout=-1) and fire them up 'randomly' with timeout=0. However, with current mapping into glib mainloop it's not possible and causing troubles.
ACK Christophe
--- libvirt-glib/libvirt-glib-event.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libvirt-glib/libvirt-glib-event.c b/libvirt-glib/libvirt-glib-event.c index 94f4de8..c3eb3c8 100644 --- a/libvirt-glib/libvirt-glib-event.c +++ b/libvirt-glib/libvirt-glib-event.c @@ -384,7 +384,7 @@ gvir_event_timeout_update(int timer,
if (interval >= 0) { if (data->source) - goto cleanup; + g_source_remove(data->source);
data->interval = interval; data->source = g_timeout_add(data->interval, -- 1.7.8.5
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On 01.06.2012 15:11, Christophe Fergeau wrote:
On Fri, Jun 01, 2012 at 01:41:54PM +0200, Michal Privoznik wrote:
In libvirt, it's perfectly possible and widely used to have disabled timers (timeout=-1) and fire them up 'randomly' with timeout=0. However, with current mapping into glib mainloop it's not possible and causing troubles.
ACK
Christophe
Thanks, pushed. Michal
participants (2)
-
Christophe Fergeau
-
Michal Privoznik