blob: 2ebd6b7fe1d4dc3a34dd6a38b471e6990fd5c8de (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/*
* QEMU Thread Context
*
* Copyright Red Hat Inc., 2022
*
* Authors:
* David Hildenbrand <david@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 SYSEMU_THREAD_CONTEXT_H
#define SYSEMU_THREAD_CONTEXT_H
#include "qapi/qapi-types-machine.h"
#include "qemu/thread.h"
#include "qom/object.h"
#define TYPE_THREAD_CONTEXT "thread-context"
OBJECT_DECLARE_TYPE(ThreadContext, ThreadContextClass,
THREAD_CONTEXT)
struct ThreadContextClass {
ObjectClass parent_class;
};
struct ThreadContext {
/* private */
Object parent;
/* private */
unsigned int thread_id;
QemuThread thread;
/* Semaphore to wait for context thread action. */
QemuSemaphore sem;
/* Semaphore to wait for action in context thread. */
QemuSemaphore sem_thread;
/* Mutex to synchronize requests. */
QemuMutex mutex;
/* Commands for the thread to execute. */
int thread_cmd;
void *thread_cmd_data;
/* CPU affinity bitmap used for initialization. */
unsigned long *init_cpu_bitmap;
int init_cpu_nbits;
};
void thread_context_create_thread(ThreadContext *tc, QemuThread *thread,
const char *name,
void *(*start_routine)(void *), void *arg,
int mode);
#endif /* SYSEMU_THREAD_CONTEXT_H */
|