]> git.proxmox.com Git - mirror_qemu.git/blame - include/sysemu/iothread.h
Delete duplicate QOM typedefs
[mirror_qemu.git] / include / sysemu / iothread.h
CommitLineData
be8d8537
SH
1/*
2 * Event loop thread
3 *
4 * Copyright Red Hat Inc., 2013
5 *
6 * Authors:
7 * Stefan Hajnoczi <stefanha@redhat.com>
8 *
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.
11 *
12 */
13
14#ifndef IOTHREAD_H
15#define IOTHREAD_H
16
17#include "block/aio.h"
8c2664d8 18#include "qemu/thread.h"
ec150c7e 19#include "qom/object.h"
be8d8537
SH
20
21#define TYPE_IOTHREAD "iothread"
22
8c2664d8
SH
23typedef struct {
24 Object parent_obj;
25
26 QemuThread thread;
27 AioContext *ctx;
b506e0f1 28 bool run_gcontext; /* whether we should run gcontext */
329163cb
WY
29 GMainContext *worker_context;
30 GMainLoop *main_loop;
21c4d15b 31 QemuSemaphore init_done_sem; /* is thread init done? */
2362a28e
SH
32 bool stopping; /* has iothread_stop() been called? */
33 bool running; /* should iothread_run() continue? */
8c2664d8 34 int thread_id;
0d9d86fb
SH
35
36 /* AioContext poll parameters */
37 int64_t poll_max_ns;
5e5db499
SH
38 int64_t poll_grow;
39 int64_t poll_shrink;
8c2664d8 40} IOThread;
be8d8537
SH
41
42#define IOTHREAD(obj) \
43 OBJECT_CHECK(IOThread, obj, TYPE_IOTHREAD)
44
be8d8537 45char *iothread_get_id(IOThread *iothread);
fbcc6923 46IOThread *iothread_by_id(const char *id);
be8d8537 47AioContext *iothread_get_aio_context(IOThread *iothread);
329163cb 48GMainContext *iothread_get_g_main_context(IOThread *iothread);
be8d8537 49
0173e21b
PX
50/*
51 * Helpers used to allocate iothreads for internal use. These
52 * iothreads will not be seen by monitor clients when query using
53 * "query-iothreads".
54 */
55IOThread *iothread_create(const char *id, Error **errp);
82d90705 56void iothread_stop(IOThread *iothread);
0173e21b
PX
57void iothread_destroy(IOThread *iothread);
58
be8d8537 59#endif /* IOTHREAD_H */