2014-03-03 11:30:05 +01:00
|
|
|
/*
|
|
|
|
* 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"
|
2014-03-20 15:06:31 +01:00
|
|
|
#include "qemu/thread.h"
|
2014-03-03 11:30:05 +01:00
|
|
|
|
|
|
|
#define TYPE_IOTHREAD "iothread"
|
|
|
|
|
2014-03-20 15:06:31 +01:00
|
|
|
typedef struct {
|
|
|
|
Object parent_obj;
|
|
|
|
|
|
|
|
QemuThread thread;
|
|
|
|
AioContext *ctx;
|
2017-08-29 09:22:37 +02:00
|
|
|
GMainContext *worker_context;
|
|
|
|
GMainLoop *main_loop;
|
|
|
|
GOnce once;
|
2014-03-20 15:06:31 +01:00
|
|
|
QemuMutex init_done_lock;
|
|
|
|
QemuCond init_done_cond; /* is thread initialization done? */
|
|
|
|
bool stopping;
|
|
|
|
int thread_id;
|
2016-12-01 20:26:45 +01:00
|
|
|
|
|
|
|
/* AioContext poll parameters */
|
|
|
|
int64_t poll_max_ns;
|
2016-12-01 20:26:52 +01:00
|
|
|
int64_t poll_grow;
|
|
|
|
int64_t poll_shrink;
|
2014-03-20 15:06:31 +01:00
|
|
|
} IOThread;
|
2014-03-03 11:30:05 +01:00
|
|
|
|
|
|
|
#define IOTHREAD(obj) \
|
|
|
|
OBJECT_CHECK(IOThread, obj, TYPE_IOTHREAD)
|
|
|
|
|
|
|
|
char *iothread_get_id(IOThread *iothread);
|
|
|
|
AioContext *iothread_get_aio_context(IOThread *iothread);
|
2016-09-08 11:28:51 +02:00
|
|
|
void iothread_stop_all(void);
|
2017-08-29 09:22:37 +02:00
|
|
|
GMainContext *iothread_get_g_main_context(IOThread *iothread);
|
2014-03-03 11:30:05 +01:00
|
|
|
|
|
|
|
#endif /* IOTHREAD_H */
|