Lines Matching full:mutex

2  * Win32 implementation for mutex/cond/thread functions
68 void qemu_mutex_init(QemuMutex *mutex) in qemu_mutex_init() argument
70 InitializeSRWLock(&mutex->lock); in qemu_mutex_init()
71 qemu_mutex_post_init(mutex); in qemu_mutex_init()
74 void qemu_mutex_destroy(QemuMutex *mutex) in qemu_mutex_destroy() argument
76 assert(mutex->initialized); in qemu_mutex_destroy()
77 mutex->initialized = false; in qemu_mutex_destroy()
78 InitializeSRWLock(&mutex->lock); in qemu_mutex_destroy()
81 void qemu_mutex_lock_impl(QemuMutex *mutex, const char *file, const int line) in qemu_mutex_lock_impl() argument
83 assert(mutex->initialized); in qemu_mutex_lock_impl()
84 qemu_mutex_pre_lock(mutex, file, line); in qemu_mutex_lock_impl()
85 AcquireSRWLockExclusive(&mutex->lock); in qemu_mutex_lock_impl()
86 qemu_mutex_post_lock(mutex, file, line); in qemu_mutex_lock_impl()
89 int qemu_mutex_trylock_impl(QemuMutex *mutex, const char *file, const int line) in qemu_mutex_trylock_impl() argument
93 assert(mutex->initialized); in qemu_mutex_trylock_impl()
94 owned = TryAcquireSRWLockExclusive(&mutex->lock); in qemu_mutex_trylock_impl()
96 qemu_mutex_post_lock(mutex, file, line); in qemu_mutex_trylock_impl()
102 void qemu_mutex_unlock_impl(QemuMutex *mutex, const char *file, const int line) in qemu_mutex_unlock_impl() argument
104 assert(mutex->initialized); in qemu_mutex_unlock_impl()
105 qemu_mutex_pre_unlock(mutex, file, line); in qemu_mutex_unlock_impl()
106 ReleaseSRWLockExclusive(&mutex->lock); in qemu_mutex_unlock_impl()
109 void qemu_rec_mutex_init(QemuRecMutex *mutex) in qemu_rec_mutex_init() argument
111 InitializeCriticalSection(&mutex->lock); in qemu_rec_mutex_init()
112 mutex->initialized = true; in qemu_rec_mutex_init()
115 void qemu_rec_mutex_destroy(QemuRecMutex *mutex) in qemu_rec_mutex_destroy() argument
117 assert(mutex->initialized); in qemu_rec_mutex_destroy()
118 mutex->initialized = false; in qemu_rec_mutex_destroy()
119 DeleteCriticalSection(&mutex->lock); in qemu_rec_mutex_destroy()
122 void qemu_rec_mutex_lock_impl(QemuRecMutex *mutex, const char *file, int line) in qemu_rec_mutex_lock_impl() argument
124 assert(mutex->initialized); in qemu_rec_mutex_lock_impl()
125 EnterCriticalSection(&mutex->lock); in qemu_rec_mutex_lock_impl()
128 int qemu_rec_mutex_trylock_impl(QemuRecMutex *mutex, const char *file, int line) in qemu_rec_mutex_trylock_impl() argument
130 assert(mutex->initialized); in qemu_rec_mutex_trylock_impl()
131 return !TryEnterCriticalSection(&mutex->lock); in qemu_rec_mutex_trylock_impl()
134 void qemu_rec_mutex_unlock_impl(QemuRecMutex *mutex, const char *file, int line) in qemu_rec_mutex_unlock_impl() argument
136 assert(mutex->initialized); in qemu_rec_mutex_unlock_impl()
137 LeaveCriticalSection(&mutex->lock); in qemu_rec_mutex_unlock_impl()
166 void qemu_cond_wait_impl(QemuCond *cond, QemuMutex *mutex, const char *file, const int line) in qemu_cond_wait_impl() argument
169 qemu_mutex_pre_unlock(mutex, file, line); in qemu_cond_wait_impl()
170 SleepConditionVariableSRW(&cond->var, &mutex->lock, INFINITE, 0); in qemu_cond_wait_impl()
171 qemu_mutex_post_lock(mutex, file, line); in qemu_cond_wait_impl()
174 bool qemu_cond_timedwait_impl(QemuCond *cond, QemuMutex *mutex, int ms, in qemu_cond_timedwait_impl() argument
180 trace_qemu_mutex_unlock(mutex, file, line); in qemu_cond_timedwait_impl()
181 if (!SleepConditionVariableSRW(&cond->var, &mutex->lock, ms, 0)) { in qemu_cond_timedwait_impl()
184 trace_qemu_mutex_locked(mutex, file, line); in qemu_cond_timedwait_impl()