contrib/libvhost-user/libvhost-user-glib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
From: Johannes Berg <johannes.berg@intel.com>
If we use NULL, we just get the main program default mainloop
here. Using g_main_context_get_thread_default() has basically
the same effect, but it lets us start different devices in
different threads with different mainloops, which can be useful.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
contrib/libvhost-user/libvhost-user-glib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/libvhost-user/libvhost-user-glib.c b/contrib/libvhost-user/libvhost-user-glib.c
index 824c7780de61..53f1ca4cdd73 100644
--- a/contrib/libvhost-user/libvhost-user-glib.c
+++ b/contrib/libvhost-user/libvhost-user-glib.c
@@ -89,7 +89,7 @@ vug_source_new(VugDev *gdev, int fd, GIOCondition cond,
src->gfd.events = cond;
g_source_add_poll(gsrc, &src->gfd);
- id = g_source_attach(gsrc, NULL);
+ id = g_source_attach(gsrc, g_main_context_get_thread_default());
g_assert(id);
return gsrc;
--
2.20.1
On Tue, Sep 17, 2019 at 4:26 PM Johannes Berg <johannes@sipsolutions.net> wrote: > > From: Johannes Berg <johannes.berg@intel.com> > > If we use NULL, we just get the main program default mainloop > here. Using g_main_context_get_thread_default() has basically > the same effect, but it lets us start different devices in > different threads with different mainloops, which can be useful. > > Signed-off-by: Johannes Berg <johannes.berg@intel.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> > --- > contrib/libvhost-user/libvhost-user-glib.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/contrib/libvhost-user/libvhost-user-glib.c b/contrib/libvhost-user/libvhost-user-glib.c > index 824c7780de61..53f1ca4cdd73 100644 > --- a/contrib/libvhost-user/libvhost-user-glib.c > +++ b/contrib/libvhost-user/libvhost-user-glib.c > @@ -89,7 +89,7 @@ vug_source_new(VugDev *gdev, int fd, GIOCondition cond, > src->gfd.events = cond; > > g_source_add_poll(gsrc, &src->gfd); > - id = g_source_attach(gsrc, NULL); > + id = g_source_attach(gsrc, g_main_context_get_thread_default()); > g_assert(id); > > return gsrc; > -- > 2.20.1 > > -- Marc-André Lureau
On Tue, Sep 17, 2019 at 02:25:12PM +0200, Johannes Berg wrote: > From: Johannes Berg <johannes.berg@intel.com> > > If we use NULL, we just get the main program default mainloop > here. Using g_main_context_get_thread_default() has basically > the same effect, but it lets us start different devices in > different threads with different mainloops, which can be useful. > > Signed-off-by: Johannes Berg <johannes.berg@intel.com> > --- > contrib/libvhost-user/libvhost-user-glib.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
© 2016 - 2025 Red Hat, Inc.