qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>,
	Wang yong <wang.yong155@zte.com.cn>
Cc: stefanha@redhat.com, famz@redhat.com, jasowang@redhat.com,
	zhang.zhanghailiang@huawei.com, lizhijian@cn.fujitsu.com,
	wang.guang55@zte.com.cn, qemu-devel@nongnu.org,
	zhangchen.fnst@cn.fujitsu.com
Subject: Re: [Qemu-devel] [PATCH v2] qemu-iothread: IOThread supports the GMainContext event loop
Date: Wed, 16 Aug 2017 13:30:55 +0200	[thread overview]
Message-ID: <0ba3aee4-4aa4-2fc8-f04e-264ed6f8d51b@redhat.com> (raw)
In-Reply-To: <20170816095238.GE3180@stefanha-x1.localdomain>

[-- Attachment #1: Type: text/plain, Size: 653 bytes --]

On 16/08/2017 11:52, Stefan Hajnoczi wrote:
> 
>     while (!atomic_read(&iothread->stopping)) {
> 	if (atomic_read(&iothread->use_glib_event_loop)) {
> 	    iothread_glib_event_loop();
> 	    break;
>         }
> 
>         aio_poll(iothread->ctx, true);
>     }

Alternatively:

    while (!atomic_read(&iothread->stopping)) {
        aio_poll(iothread->ctx, true);
    }

    if (atomic_read(&iothread->worker_context)) {
	iothread_glib_event_loop();
    }

and you can use this to enter the glib event loop:

    iothread->stopping = true;
    aio_notify(iothread->ctx);

(similar to iothread_stop).

Thanks,

Paolo


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

      reply	other threads:[~2017-08-16 11:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-15  7:28 [Qemu-devel] [PATCH v2] qemu-iothread: IOThread supports the GMainContext event loop Wang yong
2017-08-16  9:52 ` Stefan Hajnoczi
2017-08-16 11:30   ` Paolo Bonzini [this message]

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=0ba3aee4-4aa4-2fc8-f04e-264ed6f8d51b@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=famz@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=stefanha@redhat.com \
    --cc=wang.guang55@zte.com.cn \
    --cc=wang.yong155@zte.com.cn \
    --cc=zhang.zhanghailiang@huawei.com \
    --cc=zhangchen.fnst@cn.fujitsu.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).