qemu/qemu-thread.h
<<
>>
Prefs
   1#ifndef __QEMU_THREAD_H
   2#define __QEMU_THREAD_H 1
   3#include "semaphore.h"
   4#include "pthread.h"
   5
   6struct QemuMutex {
   7    pthread_mutex_t lock;
   8};
   9
  10struct QemuCond {
  11    pthread_cond_t cond;
  12};
  13
  14struct QemuThread {
  15    pthread_t thread;
  16};
  17
  18typedef struct QemuMutex QemuMutex;
  19typedef struct QemuCond QemuCond;
  20typedef struct QemuThread QemuThread;
  21
  22void qemu_mutex_init(QemuMutex *mutex);
  23void qemu_mutex_lock(QemuMutex *mutex);
  24int qemu_mutex_trylock(QemuMutex *mutex);
  25int qemu_mutex_timedlock(QemuMutex *mutex, uint64_t msecs);
  26void qemu_mutex_unlock(QemuMutex *mutex);
  27
  28void qemu_cond_init(QemuCond *cond);
  29void qemu_cond_signal(QemuCond *cond);
  30void qemu_cond_broadcast(QemuCond *cond);
  31void qemu_cond_wait(QemuCond *cond, QemuMutex *mutex);
  32int qemu_cond_timedwait(QemuCond *cond, QemuMutex *mutex, uint64_t msecs);
  33
  34void qemu_thread_create(QemuThread *thread,
  35                       void *(*start_routine)(void*),
  36                       void *arg);
  37void qemu_thread_signal(QemuThread *thread, int sig);
  38void qemu_thread_self(QemuThread *thread);
  39int qemu_thread_equal(QemuThread *thread1, QemuThread *thread2);
  40#endif
  41