hw/elf_ops: Fix a typo
[qemu/ar7.git] / include / sysemu / iothread.h
blobf177142f16c7ce44fccc18068171802713efa193
1 /*
2 * Event loop thread
4 * Copyright Red Hat Inc., 2013
6 * Authors:
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.
14 #ifndef IOTHREAD_H
15 #define IOTHREAD_H
17 #include "block/aio.h"
18 #include "qemu/thread.h"
19 #include "qom/object.h"
21 #define TYPE_IOTHREAD "iothread"
23 struct IOThread {
24 Object parent_obj;
26 QemuThread thread;
27 AioContext *ctx;
28 bool run_gcontext; /* whether we should run gcontext */
29 GMainContext *worker_context;
30 GMainLoop *main_loop;
31 QemuSemaphore init_done_sem; /* is thread init done? */
32 bool stopping; /* has iothread_stop() been called? */
33 bool running; /* should iothread_run() continue? */
34 int thread_id;
36 /* AioContext poll parameters */
37 int64_t poll_max_ns;
38 int64_t poll_grow;
39 int64_t poll_shrink;
41 typedef struct IOThread IOThread;
43 DECLARE_INSTANCE_CHECKER(IOThread, IOTHREAD,
44 TYPE_IOTHREAD)
46 char *iothread_get_id(IOThread *iothread);
47 IOThread *iothread_by_id(const char *id);
48 AioContext *iothread_get_aio_context(IOThread *iothread);
49 GMainContext *iothread_get_g_main_context(IOThread *iothread);
52 * Helpers used to allocate iothreads for internal use. These
53 * iothreads will not be seen by monitor clients when query using
54 * "query-iothreads".
56 IOThread *iothread_create(const char *id, Error **errp);
57 void iothread_stop(IOThread *iothread);
58 void iothread_destroy(IOThread *iothread);
61 * Returns true if executing withing IOThread context,
62 * false otherwise.
64 bool qemu_in_iothread(void);
66 #endif /* IOTHREAD_H */