4 * Copyright Red Hat Inc., 2022
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.
13 #ifndef SYSEMU_THREAD_CONTEXT_H
14 #define SYSEMU_THREAD_CONTEXT_H
16 #include "qapi/qapi-types-machine.h"
17 #include "qemu/thread.h"
18 #include "qom/object.h"
20 #define TYPE_THREAD_CONTEXT "thread-context"
21 OBJECT_DECLARE_TYPE(ThreadContext, ThreadContextClass,
24 struct ThreadContextClass {
25 ObjectClass parent_class;
28 struct ThreadContext {
33 unsigned int thread_id;
36 /* Semaphore to wait for context thread action. */
38 /* Semaphore to wait for action in context thread. */
39 QemuSemaphore sem_thread;
40 /* Mutex to synchronize requests. */
43 /* Commands for the thread to execute. */
45 void *thread_cmd_data;
47 /* CPU affinity bitmap used for initialization. */
48 unsigned long *init_cpu_bitmap;
52 void thread_context_create_thread(ThreadContext *tc, QemuThread *thread,
54 void *(*start_routine)(void *), void *arg,
57 #endif /* SYSEMU_THREAD_CONTEXT_H */