migration: close socket QEMUFile from socket_close
[qemu/opensuse.git] / qemu-thread.h
blob3ee2f6b1f9a82f8654c803faf9e162a985687a60
1 #ifndef __QEMU_THREAD_H
2 #define __QEMU_THREAD_H 1
4 #include <inttypes.h>
5 #include <stdbool.h>
7 typedef struct QemuMutex QemuMutex;
8 typedef struct QemuCond QemuCond;
9 typedef struct QemuSemaphore QemuSemaphore;
10 typedef struct QemuThread QemuThread;
12 #ifdef _WIN32
13 #include "qemu-thread-win32.h"
14 #else
15 #include "qemu-thread-posix.h"
16 #endif
18 #define QEMU_THREAD_JOINABLE 0
19 #define QEMU_THREAD_DETACHED 1
21 void qemu_mutex_init(QemuMutex *mutex);
22 void qemu_mutex_destroy(QemuMutex *mutex);
23 void qemu_mutex_lock(QemuMutex *mutex);
24 int qemu_mutex_trylock(QemuMutex *mutex);
25 void qemu_mutex_unlock(QemuMutex *mutex);
27 #define rcu_read_lock() do { } while (0)
28 #define rcu_read_unlock() do { } while (0)
30 void qemu_cond_init(QemuCond *cond);
31 void qemu_cond_destroy(QemuCond *cond);
34 * IMPORTANT: The implementation does not guarantee that pthread_cond_signal
35 * and pthread_cond_broadcast can be called except while the same mutex is
36 * held as in the corresponding pthread_cond_wait calls!
38 void qemu_cond_signal(QemuCond *cond);
39 void qemu_cond_broadcast(QemuCond *cond);
40 void qemu_cond_wait(QemuCond *cond, QemuMutex *mutex);
42 void qemu_sem_init(QemuSemaphore *sem, int init);
43 void qemu_sem_post(QemuSemaphore *sem);
44 void qemu_sem_wait(QemuSemaphore *sem);
45 int qemu_sem_timedwait(QemuSemaphore *sem, int ms);
46 void qemu_sem_destroy(QemuSemaphore *sem);
48 void qemu_thread_create(QemuThread *thread,
49 void *(*start_routine)(void *),
50 void *arg, int mode);
51 void *qemu_thread_join(QemuThread *thread);
52 void qemu_thread_get_self(QemuThread *thread);
53 bool qemu_thread_is_self(QemuThread *thread);
54 void qemu_thread_exit(void *retval);
56 #endif