diff options
| author | Philippe Mathieu-Daudé <philmd@linaro.org> | 2024-12-03 15:20:13 +0100 |
|---|---|---|
| committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2024-12-20 17:44:56 +0100 |
| commit | 32cad1ffb81dcecf6f4a8af56d6e5892682839b1 (patch) | |
| tree | 6795b32d9c9a6406c9bbca905b9de8a90401af7f /include/system/iothread.h | |
| parent | 63cda19446c5307cc05b965c203742a583fc5abf (diff) | |
| download | focaccia-qemu-32cad1ffb81dcecf6f4a8af56d6e5892682839b1.tar.gz focaccia-qemu-32cad1ffb81dcecf6f4a8af56d6e5892682839b1.zip | |
include: Rename sysemu/ -> system/
Headers in include/sysemu/ are not only related to system *emulation*, they are also used by virtualization. Rename as system/ which is clearer. Files renamed manually then mechanical change using sed tool. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Tested-by: Lei Yang <leiyang@redhat.com> Message-Id: <20241203172445.28576-1-philmd@linaro.org>
Diffstat (limited to 'include/system/iothread.h')
| -rw-r--r-- | include/system/iothread.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/include/system/iothread.h b/include/system/iothread.h new file mode 100644 index 0000000000..d95c17a645 --- /dev/null +++ b/include/system/iothread.h @@ -0,0 +1,67 @@ +/* + * 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" +#include "qom/object.h" +#include "system/event-loop-base.h" + +#define TYPE_IOTHREAD "iothread" + +struct IOThread { + EventLoopBase parent_obj; + + QemuThread thread; + AioContext *ctx; + bool run_gcontext; /* whether we should run gcontext */ + GMainContext *worker_context; + GMainLoop *main_loop; + QemuSemaphore init_done_sem; /* is thread init done? */ + bool stopping; /* has iothread_stop() been called? */ + bool running; /* should iothread_run() continue? */ + int thread_id; + + /* AioContext poll parameters */ + int64_t poll_max_ns; + int64_t poll_grow; + int64_t poll_shrink; +}; +typedef struct IOThread IOThread; + +DECLARE_INSTANCE_CHECKER(IOThread, IOTHREAD, + TYPE_IOTHREAD) + +char *iothread_get_id(IOThread *iothread); +IOThread *iothread_by_id(const char *id); +AioContext *iothread_get_aio_context(IOThread *iothread); +GMainContext *iothread_get_g_main_context(IOThread *iothread); + +/* + * Helpers used to allocate iothreads for internal use. These + * iothreads will not be seen by monitor clients when query using + * "query-iothreads". + */ +IOThread *iothread_create(const char *id, Error **errp); +void iothread_stop(IOThread *iothread); +void iothread_destroy(IOThread *iothread); + +/* + * Returns true if executing within IOThread context, + * false otherwise. + */ +bool qemu_in_iothread(void); + +#endif /* IOTHREAD_H */ |