[libvirt] [libvirt-glib] Add "priority" argument to gvir_stream_add_watch_full

Christophe Fergeau cfergeau at redhat.com
Wed Dec 7 13:16:03 UTC 2011


This is more consistent with what all the other glib _full APIs
are doing.
---
 libvirt-gobject/libvirt-gobject-input-stream.c  |    1 +
 libvirt-gobject/libvirt-gobject-output-stream.c |    1 +
 libvirt-gobject/libvirt-gobject-stream.c        |    5 +++++
 libvirt-gobject/libvirt-gobject-stream.h        |    1 +
 4 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/libvirt-gobject/libvirt-gobject-input-stream.c b/libvirt-gobject/libvirt-gobject-input-stream.c
index a890471..6b9f075 100644
--- a/libvirt-gobject/libvirt-gobject-input-stream.c
+++ b/libvirt-gobject/libvirt-gobject-input-stream.c
@@ -161,6 +161,7 @@ static void gvir_input_stream_read_async(GInputStream *stream,
     g_return_if_fail(input_stream->priv->result == NULL);
 
     gvir_stream_add_watch_full(input_stream->priv->stream,
+                               G_PRIORITY_DEFAULT,
                                GVIR_STREAM_IO_CONDITION_READABLE,
                                gvir_input_stream_read_ready,
                                g_object_ref(stream),
diff --git a/libvirt-gobject/libvirt-gobject-output-stream.c b/libvirt-gobject/libvirt-gobject-output-stream.c
index f70f282..741b2bc 100644
--- a/libvirt-gobject/libvirt-gobject-output-stream.c
+++ b/libvirt-gobject/libvirt-gobject-output-stream.c
@@ -161,6 +161,7 @@ static void gvir_output_stream_write_async(GOutputStream *stream,
     g_return_if_fail(output_stream->priv->result == NULL);
 
     gvir_stream_add_watch_full(output_stream->priv->stream,
+                               G_PRIORITY_DEFAULT,
                                GVIR_STREAM_IO_CONDITION_WRITABLE,
                                gvir_output_stream_write_ready,
                                g_object_ref(stream),
diff --git a/libvirt-gobject/libvirt-gobject-stream.c b/libvirt-gobject/libvirt-gobject-stream.c
index c1ae765..1e4721f 100644
--- a/libvirt-gobject/libvirt-gobject-stream.c
+++ b/libvirt-gobject/libvirt-gobject-stream.c
@@ -605,6 +605,7 @@ guint gvir_stream_add_watch(GVirStream *stream,
                             gpointer opaque)
 {
     return gvir_stream_add_watch_full(stream,
+                                      G_PRIORITY_DEFAULT,
                                       cond,
                                       func,
                                       opaque,
@@ -612,6 +613,7 @@ guint gvir_stream_add_watch(GVirStream *stream,
 }
 
 guint gvir_stream_add_watch_full(GVirStream *stream,
+                                 gint priority,
                                  GVirStreamIOCondition cond,
                                  GVirStreamIOFunc func,
                                  gpointer opaque,
@@ -625,6 +627,9 @@ guint gvir_stream_add_watch_full(GVirStream *stream,
     source->stream = stream;
     source->cond = cond;
 
+    if (priority != G_PRIORITY_DEFAULT)
+        g_source_set_priority((GSource*)source, priority);
+
     priv->sources = g_list_append(priv->sources, source);
 
     gvir_stream_update_events(source->stream);
diff --git a/libvirt-gobject/libvirt-gobject-stream.h b/libvirt-gobject/libvirt-gobject-stream.h
index 3caadc3..d3c9347 100644
--- a/libvirt-gobject/libvirt-gobject-stream.h
+++ b/libvirt-gobject/libvirt-gobject-stream.h
@@ -109,6 +109,7 @@ guint gvir_stream_add_watch(GVirStream *stream,
                             GVirStreamIOFunc func,
                             gpointer opaque);
 guint gvir_stream_add_watch_full(GVirStream *stream,
+                                 gint priority,
                                  GVirStreamIOCondition cond,
                                  GVirStreamIOFunc func,
                                  gpointer opaque,
-- 
1.7.7.3




More information about the libvir-list mailing list