4 * Copyright Red Hat Inc., 2013
7 * Stefan Hajnoczi <stefanha@redhat.com>
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
17 #include "block/aio.h"
18 #include "qemu/thread.h"
19 #include "qom/object.h"
21 #define TYPE_IOTHREAD "iothread"
28 bool run_gcontext
; /* whether we should run gcontext */
29 GMainContext
*worker_context
;
31 QemuSemaphore init_done_sem
; /* is thread init done? */
32 bool stopping
; /* has iothread_stop() been called? */
33 bool running
; /* should iothread_run() continue? */
36 /* AioContext poll parameters */
41 /* AioContext AIO engine parameters */
42 int64_t aio_max_batch
;
44 typedef struct IOThread IOThread
;
46 DECLARE_INSTANCE_CHECKER(IOThread
, IOTHREAD
,
49 char *iothread_get_id(IOThread
*iothread
);
50 IOThread
*iothread_by_id(const char *id
);
51 AioContext
*iothread_get_aio_context(IOThread
*iothread
);
52 GMainContext
*iothread_get_g_main_context(IOThread
*iothread
);
55 * Helpers used to allocate iothreads for internal use. These
56 * iothreads will not be seen by monitor clients when query using
59 IOThread
*iothread_create(const char *id
, Error
**errp
);
60 void iothread_stop(IOThread
*iothread
);
61 void iothread_destroy(IOThread
*iothread
);
64 * Returns true if executing withing IOThread context,
67 bool qemu_in_iothread(void);
69 #endif /* IOTHREAD_H */