xref: /kvmtool/include/kvm/mutex.h (revision 4ef0f4d620fa5df6d61ff6d4fff7f03680c7e73e)
1 #ifndef KVM__MUTEX_H
2 #define KVM__MUTEX_H
3 
4 #include <pthread.h>
5 
6 #include "kvm/util.h"
7 
8 static inline void mutex_lock(pthread_mutex_t *mutex)
9 {
10 	if (pthread_mutex_lock(mutex) != 0)
11 		die("unexpected pthread_mutex_lock() failure!");
12 }
13 
14 static inline void mutex_unlock(pthread_mutex_t *mutex)
15 {
16 	if (pthread_mutex_unlock(mutex) != 0)
17 		die("unexpected pthread_mutex_unlock() failure!");
18 }
19 
20 #endif /* KVM__MUTEX_H */
21