329163cbe6
IOThread uses AioContext event loop and does not run a GMainContext. Therefore,chardev cannot work in IOThread,such as the chardev is used for colo-compare packets reception. This patch makes the IOThread run the GMainContext event loop, chardev and IOThread can work together. Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Wang Yong <wang.yong155@zte.com.cn> Signed-off-by: Wang Guang <wang.guang55@zte.com.cn> Signed-off-by: Jason Wang <jasowang@redhat.com>
50 lines
1.1 KiB
C
50 lines
1.1 KiB
C
/*
|
|
* Event loop thread
|
|
*
|
|
* Copyright Red Hat Inc., 2013
|
|
*
|
|
* Authors:
|
|
* Stefan Hajnoczi <stefanha@redhat.com>
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
* See the COPYING file in the top-level directory.
|
|
*
|
|
*/
|
|
|
|
#ifndef IOTHREAD_H
|
|
#define IOTHREAD_H
|
|
|
|
#include "block/aio.h"
|
|
#include "qemu/thread.h"
|
|
|
|
#define TYPE_IOTHREAD "iothread"
|
|
|
|
typedef struct {
|
|
Object parent_obj;
|
|
|
|
QemuThread thread;
|
|
AioContext *ctx;
|
|
GMainContext *worker_context;
|
|
GMainLoop *main_loop;
|
|
GOnce once;
|
|
QemuMutex init_done_lock;
|
|
QemuCond init_done_cond; /* is thread initialization done? */
|
|
bool stopping;
|
|
int thread_id;
|
|
|
|
/* AioContext poll parameters */
|
|
int64_t poll_max_ns;
|
|
int64_t poll_grow;
|
|
int64_t poll_shrink;
|
|
} IOThread;
|
|
|
|
#define IOTHREAD(obj) \
|
|
OBJECT_CHECK(IOThread, obj, TYPE_IOTHREAD)
|
|
|
|
char *iothread_get_id(IOThread *iothread);
|
|
AioContext *iothread_get_aio_context(IOThread *iothread);
|
|
void iothread_stop_all(void);
|
|
GMainContext *iothread_get_g_main_context(IOThread *iothread);
|
|
|
|
#endif /* IOTHREAD_H */
|