qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Johannes Berg" <johannes.berg@intel.com>,
	mst@redhat.com
Subject: [PATCH v5 3/6] libvhost-user-glib: use g_main_context_get_thread_default()
Date: Thu, 23 Jan 2020 09:17:05 +0100	[thread overview]
Message-ID: <20200123081708.7817-4-johannes@sipsolutions.net> (raw)
In-Reply-To: <20200123081708.7817-1-johannes@sipsolutions.net>

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.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
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.24.1



  parent reply	other threads:[~2020-01-23  8:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-23  8:17 [PATCH v5 0/6] small vhost changes and in-band notifications Johannes Berg
2020-01-23  8:17 ` [PATCH v5 1/6] libvhost-user: implement VHOST_USER_PROTOCOL_F_REPLY_ACK Johannes Berg
2020-01-23  8:17 ` [PATCH v5 2/6] libvhost-user-glib: fix VugDev main fd cleanup Johannes Berg
2020-01-23  8:17 ` Johannes Berg [this message]
2020-01-23  8:17 ` [PATCH v5 4/6] libvhost-user: handle NOFD flag in call/kick/err better Johannes Berg
2020-01-23  8:17 ` [PATCH v5 5/6] docs: vhost-user: add in-band kick/call messages Johannes Berg
2020-01-23  8:17 ` [PATCH v5 6/6] libvhost-user: implement in-band notifications Johannes Berg
2020-02-13 13:26 ` [PATCH v5 0/6] small vhost changes and " Johannes Berg
2020-02-13 13:35   ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200123081708.7817-4-johannes@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=johannes.berg@intel.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).