[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/3] chardev: let g_idle_add() be with chardev g
From: |
Marc-André Lureau |
Subject: |
Re: [Qemu-devel] [PATCH 2/3] chardev: let g_idle_add() be with chardev gcontext |
Date: |
Tue, 2 Jan 2018 17:02:16 +0100 |
On Thu, Dec 28, 2017 at 8:29 AM, Peter Xu <address@hidden> wrote:
> The idle task will be attached to main gcontext even if the chardev
> backend is running in another gcontext. Fix the only caller by
> extending the g_idle_add() logic into the more powerful
> g_source_attach(). It's basically g_idle_add_full() implementation, but
> with the chardev's gcontext passed in.
>
> Signed-off-by: Peter Xu <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
> ---
> chardev/char-pty.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/chardev/char-pty.c b/chardev/char-pty.c
> index 761ae6dec1..dd17b1b823 100644
> --- a/chardev/char-pty.c
> +++ b/chardev/char-pty.c
> @@ -210,9 +210,14 @@ static void pty_chr_state(Chardev *chr, int connected)
> s->timer_tag = 0;
> }
> if (!s->connected) {
> + GSource *source = g_idle_source_new();
> +
> g_assert(s->open_tag == 0);
> s->connected = 1;
> - s->open_tag = g_idle_add(qemu_chr_be_generic_open_func, chr);
> + g_source_set_callback(source, qemu_chr_be_generic_open_func,
> + chr, NULL);
> + s->open_tag = g_source_attach(source, chr->gcontext);
> + g_source_unref(source);
> }
> if (!chr->gsource) {
> chr->gsource = io_add_watch_poll(chr, s->ioc,
> --
> 2.14.3
>
>
--
Marc-André Lureau
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH 2/3] chardev: let g_idle_add() be with chardev gcontext,
Marc-André Lureau <=