qemu-e2k/include/chardev
Peter Xu 2c716ba150 chardev: introduce qemu_chr_timeout_add_ms()
It's a replacement of g_timeout_add[_seconds]() for chardevs.  Chardevs
now can have dedicated gcontext, we should always bind chardev tasks
onto those gcontext rather than the default main context.  Since there
are quite a few of g_timeout_add[_seconds]() callers, a new function
qemu_chr_timeout_add_ms() is introduced.

One thing to mention is that, terminal3270 is still always running on
main gcontext.  However let's convert that as well since it's still part
of chardev codes and in case one day we'll miss that when we move it out
of main gcontext too.

Also, convert all the timers from GSource tags into GSource pointers.
Gsource tag IDs and g_source_remove()s can only work with default
gcontext, while now these GSources can logically be attached to other
contexts.  So let's use explicit g_source_destroy() plus another
g_source_unref() to remove a timer.

Note: when in the timer handler, we don't need the g_source_destroy()
any more since that'll be done automatically if the timer handler
returns false (and that's what all the current handlers do).

Yet another note: in pty_chr_rearm_timer() we take special care for
ms=1000.  This patch merged the two cases into one.

Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20180104141835.17987-4-peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-01-12 13:22:02 +01:00
..
char-fd.h char-fd: remove useless chr pointer 2017-08-01 17:27:33 +02:00
char-fe.h char: avoid chardevice direct access 2017-07-14 11:04:33 +02:00
char-io.h
char-mux.h char: move CharBackend handling in char-fe unit 2017-06-02 11:33:53 +04:00
char-parallel.h char: fix alias devices regression 2017-06-08 17:57:36 +04:00
char-serial.h char: fix alias devices regression 2017-06-08 17:57:36 +04:00
char-win-stdio.h
char-win.h
char.h chardev: introduce qemu_chr_timeout_add_ms() 2018-01-12 13:22:02 +01:00