xref: /haiku/src/libs/posix_error_mapper/pthread_mutex.cpp (revision 662dfd3a3f13cdd796bb67ae5669e64512ef5b7d)
139d58e2fSIngo Weinhold /*
239d58e2fSIngo Weinhold  * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
339d58e2fSIngo Weinhold  * Distributed under the terms of the MIT License.
439d58e2fSIngo Weinhold  */
539d58e2fSIngo Weinhold 
639d58e2fSIngo Weinhold #include <pthread.h>
739d58e2fSIngo Weinhold 
839d58e2fSIngo Weinhold #include "posix_error_mapper.h"
939d58e2fSIngo Weinhold 
1039d58e2fSIngo Weinhold 
1139d58e2fSIngo Weinhold WRAPPER_FUNCTION(int, pthread_mutex_destroy, (pthread_mutex_t *mutex),
1239d58e2fSIngo Weinhold 	return B_TO_POSITIVE_ERROR(sReal_pthread_mutex_destroy(mutex));
1339d58e2fSIngo Weinhold )
1439d58e2fSIngo Weinhold 
1539d58e2fSIngo Weinhold 
1639d58e2fSIngo Weinhold WRAPPER_FUNCTION(int, pthread_mutex_getprioceiling,
17*662dfd3aSJulian Harnath 		(const pthread_mutex_t *mutex, int *_priorityCeiling),
1839d58e2fSIngo Weinhold 	return B_TO_POSITIVE_ERROR(sReal_pthread_mutex_getprioceiling(mutex,
1939d58e2fSIngo Weinhold 		_priorityCeiling));
2039d58e2fSIngo Weinhold )
2139d58e2fSIngo Weinhold 
2239d58e2fSIngo Weinhold 
2339d58e2fSIngo Weinhold WRAPPER_FUNCTION(int, pthread_mutex_init,
2439d58e2fSIngo Weinhold 		(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr),
2539d58e2fSIngo Weinhold 	return B_TO_POSITIVE_ERROR(sReal_pthread_mutex_init(mutex, attr));
2639d58e2fSIngo Weinhold )
2739d58e2fSIngo Weinhold 
2839d58e2fSIngo Weinhold 
2939d58e2fSIngo Weinhold WRAPPER_FUNCTION(int, pthread_mutex_lock, (pthread_mutex_t *mutex),
3039d58e2fSIngo Weinhold 	return B_TO_POSITIVE_ERROR(sReal_pthread_mutex_lock(mutex));
3139d58e2fSIngo Weinhold )
3239d58e2fSIngo Weinhold 
3339d58e2fSIngo Weinhold 
3439d58e2fSIngo Weinhold WRAPPER_FUNCTION(int, pthread_mutex_setprioceiling,
3539d58e2fSIngo Weinhold 		(pthread_mutex_t *mutex, int newPriorityCeiling,
3639d58e2fSIngo Weinhold 		int *_oldPriorityCeiling),
3739d58e2fSIngo Weinhold 	return B_TO_POSITIVE_ERROR(sReal_pthread_mutex_setprioceiling(mutex,
3839d58e2fSIngo Weinhold 		newPriorityCeiling, _oldPriorityCeiling));
3939d58e2fSIngo Weinhold )
4039d58e2fSIngo Weinhold 
4139d58e2fSIngo Weinhold 
4239d58e2fSIngo Weinhold WRAPPER_FUNCTION(int, pthread_mutex_timedlock,
4339d58e2fSIngo Weinhold 		(pthread_mutex_t *mutex, const struct timespec *spec),
4439d58e2fSIngo Weinhold 	return B_TO_POSITIVE_ERROR(sReal_pthread_mutex_timedlock(mutex, spec));
4539d58e2fSIngo Weinhold )
4639d58e2fSIngo Weinhold 
4739d58e2fSIngo Weinhold 
4839d58e2fSIngo Weinhold WRAPPER_FUNCTION(int, pthread_mutex_trylock, (pthread_mutex_t *mutex),
4939d58e2fSIngo Weinhold 	return B_TO_POSITIVE_ERROR(sReal_pthread_mutex_trylock(mutex));
5039d58e2fSIngo Weinhold )
5139d58e2fSIngo Weinhold 
5239d58e2fSIngo Weinhold 
5339d58e2fSIngo Weinhold WRAPPER_FUNCTION(int, pthread_mutex_unlock, (pthread_mutex_t *mutex),
5439d58e2fSIngo Weinhold 	return B_TO_POSITIVE_ERROR(sReal_pthread_mutex_unlock(mutex));
5539d58e2fSIngo Weinhold )
56