summaryrefslogblamecommitdiffstats
path: root/include/qemu/thread-win32.h
blob: d0a1a9597eb05a66df50de293f00fea7cb2f5173 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11

                           

                    

                  
                 



                         
                     

  


                                         
                     


                                                 


                                                                               

                                                
                 
                           
                     

  

                      
                     

  
                  
              
                 
                     

  
                                             
                   

                         

  
                                       
                                                         
 
      
#ifndef QEMU_THREAD_WIN32_H
#define QEMU_THREAD_WIN32_H

#include <windows.h>

struct QemuMutex {
    SRWLOCK lock;
#ifdef CONFIG_DEBUG_MUTEX
    const char *file;
    int line;
#endif
    bool initialized;
};

typedef struct QemuRecMutex QemuRecMutex;
struct QemuRecMutex {
    CRITICAL_SECTION lock;
    bool initialized;
};

void qemu_rec_mutex_destroy(QemuRecMutex *mutex);
void qemu_rec_mutex_lock_impl(QemuRecMutex *mutex, const char *file, int line);
int qemu_rec_mutex_trylock_impl(QemuRecMutex *mutex, const char *file,
                                int line);
void qemu_rec_mutex_unlock(QemuRecMutex *mutex);

struct QemuCond {
    CONDITION_VARIABLE var;
    bool initialized;
};

struct QemuSemaphore {
    HANDLE sema;
    bool initialized;
};

struct QemuEvent {
    int value;
    HANDLE event;
    bool initialized;
};

typedef struct QemuThreadData QemuThreadData;
struct QemuThread {
    QemuThreadData *data;
    unsigned tid;
};

/* Only valid for joinable threads.  */
HANDLE qemu_thread_get_handle(struct QemuThread *thread);

#endif