summaryrefslogtreecommitdiff
path: root/src/util/vireventglibwatch.h
diff options
context:
space:
mode:
authorDaniel P. Berrangé <berrange@redhat.com>2020-07-28 15:54:13 +0100
committerDaniel P. Berrangé <berrange@redhat.com>2020-08-07 12:43:56 +0100
commitda0a1827084252d58909949d5f1207ec51c6c829 (patch)
tree3c619e0ba21f15ca89372a0fc584d60e16df63f5 /src/util/vireventglibwatch.h
parent84bb5fd1ab2bce88e508d416f4bcea520c803ea8 (diff)
downloadlibvirt-da0a1827084252d58909949d5f1207ec51c6c829.tar.gz
util: keep track of full GSource object not source ID number
The source ID number is an alternative way to identify a source that has been added to a GMainContext. Internally when a source ID is given, glib will lookup the corresponding GSource and use that. The use of a source ID is racy in some cases though, because it is invalid to continue to use an ID number after the GSource has been removed. It is thus safer to use the GSource object directly and have full control over the ref counting and thus cleanup. Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'src/util/vireventglibwatch.h')
-rw-r--r--src/util/vireventglibwatch.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/util/vireventglibwatch.h b/src/util/vireventglibwatch.h
index 2f7e61cfba..f57be1f503 100644
--- a/src/util/vireventglibwatch.h
+++ b/src/util/vireventglibwatch.h
@@ -40,9 +40,10 @@ typedef gboolean (*virEventGLibSocketFunc)(int fd,
GIOCondition condition,
gpointer data);
-guint virEventGLibAddSocketWatch(int fd,
- GIOCondition condition,
- GMainContext *context,
- virEventGLibSocketFunc func,
- gpointer opaque,
- GDestroyNotify notify);
+GSource *virEventGLibAddSocketWatch(int fd,
+ GIOCondition condition,
+ GMainContext *context,
+ virEventGLibSocketFunc func,
+ gpointer opaque,
+ GDestroyNotify notify)
+ G_GNUC_WARN_UNUSED_RESULT;