xref: /haiku/src/libs/posix_error_mapper/pthread_spinlock.cpp (revision b9d586e9d98da9083137dc5cafc5ec9b1980fb22)
1*b9d586e9SIngo Weinhold /*
2*b9d586e9SIngo Weinhold  * Copyright 2010, Ingo Weinhold, ingo_weinhold@gmx.de.
3*b9d586e9SIngo Weinhold  * Distributed under the terms of the MIT License.
4*b9d586e9SIngo Weinhold  */
5*b9d586e9SIngo Weinhold 
6*b9d586e9SIngo Weinhold #include <pthread.h>
7*b9d586e9SIngo Weinhold 
8*b9d586e9SIngo Weinhold #include "posix_error_mapper.h"
9*b9d586e9SIngo Weinhold 
10*b9d586e9SIngo Weinhold 
11*b9d586e9SIngo Weinhold WRAPPER_FUNCTION(int, pthread_spin_init,
12*b9d586e9SIngo Weinhold 		(pthread_spinlock_t* lock, int pshared),
13*b9d586e9SIngo Weinhold 	return B_TO_POSITIVE_ERROR(sReal_pthread_spin_init(lock, pshared));
14*b9d586e9SIngo Weinhold )
15*b9d586e9SIngo Weinhold 
16*b9d586e9SIngo Weinhold 
17*b9d586e9SIngo Weinhold WRAPPER_FUNCTION(int, pthread_spin_destroy, (pthread_spinlock_t* lock),
18*b9d586e9SIngo Weinhold 	return B_TO_POSITIVE_ERROR(sReal_pthread_spin_destroy(lock));
19*b9d586e9SIngo Weinhold )
20*b9d586e9SIngo Weinhold 
21*b9d586e9SIngo Weinhold 
22*b9d586e9SIngo Weinhold WRAPPER_FUNCTION(int, pthread_spin_lock, (pthread_spinlock_t* lock),
23*b9d586e9SIngo Weinhold 	return B_TO_POSITIVE_ERROR(sReal_pthread_spin_lock(lock));
24*b9d586e9SIngo Weinhold )
25*b9d586e9SIngo Weinhold 
26*b9d586e9SIngo Weinhold 
27*b9d586e9SIngo Weinhold WRAPPER_FUNCTION(int, pthread_spin_trylock, (pthread_spinlock_t* lock),
28*b9d586e9SIngo Weinhold 	return B_TO_POSITIVE_ERROR(sReal_pthread_spin_trylock(lock));
29*b9d586e9SIngo Weinhold )
30*b9d586e9SIngo Weinhold 
31*b9d586e9SIngo Weinhold 
32*b9d586e9SIngo Weinhold WRAPPER_FUNCTION(int, pthread_spin_unlock, (pthread_spinlock_t* lock),
33*b9d586e9SIngo Weinhold 	return B_TO_POSITIVE_ERROR(sReal_pthread_spin_unlock(lock));
34*b9d586e9SIngo Weinhold )
35