diff options
author | Zhang Chen <zhangchen.fnst@cn.fujitsu.com> | 2016-09-27 10:22:25 +0800 |
---|---|---|
committer | Jason Wang <jasowang@redhat.com> | 2016-09-27 17:54:21 +0800 |
commit | e92aa36ac89fad49dc18d88e1d40f0d0fccdfa83 (patch) | |
tree | a42a84d56f8576f19cbe5f56bbd77a0e08f01e7b /include/sysemu/char.h | |
parent | a4543b1b37dc05be84c7a95751af9d473f5fb41a (diff) | |
download | qemu-e92aa36ac89fad49dc18d88e1d40f0d0fccdfa83.tar.gz qemu-e92aa36ac89fad49dc18d88e1d40f0d0fccdfa83.tar.bz2 qemu-e92aa36ac89fad49dc18d88e1d40f0d0fccdfa83.zip |
qemu-char: Add qemu_chr_add_handlers_full() for GMaincontext
Add qemu_chr_add_handlers_full() API, we can use
this API pass in a GMainContext,make handler run
in the context rather than main_loop.
This comments from Daniel P . Berrange.
Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'include/sysemu/char.h')
-rw-r--r-- | include/sysemu/char.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/include/sysemu/char.h b/include/sysemu/char.h index ee7e55468f..0d0465ae0e 100644 --- a/include/sysemu/char.h +++ b/include/sysemu/char.h @@ -65,7 +65,8 @@ struct CharDriverState { int (*chr_sync_read)(struct CharDriverState *s, const uint8_t *buf, int len); GSource *(*chr_add_watch)(struct CharDriverState *s, GIOCondition cond); - void (*chr_update_read_handler)(struct CharDriverState *s); + void (*chr_update_read_handler)(struct CharDriverState *s, + GMainContext *context); int (*chr_ioctl)(struct CharDriverState *s, int cmd, void *arg); int (*get_msgfds)(struct CharDriverState *s, int* fds, int num); int (*set_msgfds)(struct CharDriverState *s, int *fds, int num); @@ -422,6 +423,14 @@ void qemu_chr_add_handlers(CharDriverState *s, IOEventHandler *fd_event, void *opaque); +/* This API can make handler run in the context what you pass to. */ +void qemu_chr_add_handlers_full(CharDriverState *s, + IOCanReadHandler *fd_can_read, + IOReadHandler *fd_read, + IOEventHandler *fd_event, + void *opaque, + GMainContext *context); + void qemu_chr_be_generic_open(CharDriverState *s); void qemu_chr_accept_input(CharDriverState *s); int qemu_chr_add_client(CharDriverState *s, int fd); |