mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
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>
This commit is contained in:
parent
a4543b1b37
commit
e92aa36ac8
2 changed files with 63 additions and 25 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue