On Thu, Jan 04, 2018 at 06:43:33PM +0800, Peter Xu wrote: > v3: > - rename function to qemu_chr_timeout_add_ms() [Stefan] > - add comment on return code [Stefan] > - add comment in commit message on why change GSource name [Stefan] > > v2: > - add r-bs > - fix patch 3 on some s->ms conversion [Marc-André] > > There were existing work that tried to allow chardev to be run in a > dedicated gcontext rather than the default main context/thread. > Basically that work passed in the correct gcontext during > g_source_attach(). However, I found something missing along the way, > that some legacy glib APIs are used by chardev code which take the > main context as default: > > g_timeout_add_seconds > g_timeout_add > g_idle_add
Self NAK. I just noticed something more critical: these calls are still managing gsources using IDs rather than GSource objects. That should not work, especially if we want to remove these events using g_source_remove(). That can be fairly dangerous after OOB series merged. I need to use GSource objects to replace the tag IDs. I'll prepare another version tomorrow. Sorry for the troublesome. > > To fully allow the chardevs to be run in dedicated gcontext, we need > to convert all these legacy APIs into g_source_attach() calls as well, > with the correct gcontext passed in. > > This series tries to clean the rest of things up. > > I picked up patch 1 from monitor-oob series into this series (which is > a missing of chardev frontend call fix for g_source_attach()), so that > this series can be a complete fix. > > Please review. Thanks, > > Peter Xu (3): > chardev: use backend chr context when watch for fe > chardev: let g_idle_add() be with chardev gcontext > chardev: introduce qemu_chr_timeout_add_ms() > > chardev/char-fe.c | 2 +- > chardev/char-pty.c | 16 ++++++++-------- > chardev/char-socket.c | 6 ++++-- > chardev/char.c | 21 +++++++++++++++++++++ > hw/char/terminal3270.c | 7 ++++--- > include/chardev/char.h | 3 +++ > 6 files changed, 41 insertions(+), 14 deletions(-) > > -- > 2.14.3 > -- Peter Xu