1 /* 2 * Copyright 2009-2011, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include <pthread.h> 8 #include <signal.h> 9 10 #include "posix_error_mapper.h" 11 12 13 WRAPPER_FUNCTION(int, pthread_create, 14 (pthread_t *thread, const pthread_attr_t *attr, 15 void *(*start_routine)(void*), void *arg), 16 return B_TO_POSITIVE_ERROR(sReal_pthread_create(thread, attr, start_routine, 17 arg)); 18 ) 19 20 21 WRAPPER_FUNCTION(int, pthread_detach, (pthread_t thread), 22 return B_TO_POSITIVE_ERROR(sReal_pthread_detach(thread)); 23 ) 24 25 26 WRAPPER_FUNCTION(int, pthread_join, (pthread_t thread, void **_value), 27 return B_TO_POSITIVE_ERROR(sReal_pthread_join(thread, _value)); 28 ) 29 30 31 WRAPPER_FUNCTION(int, pthread_kill, (pthread_t thread, int sig), 32 return B_TO_POSITIVE_ERROR(sReal_pthread_kill(thread, sig)); 33 ) 34 35 36 WRAPPER_FUNCTION(int, pthread_setconcurrency, (int newLevel), 37 return B_TO_POSITIVE_ERROR(sReal_pthread_setconcurrency(newLevel)); 38 ) 39 40 41 WRAPPER_FUNCTION(int, pthread_cancel, (pthread_t thread), 42 return B_TO_POSITIVE_ERROR(sReal_pthread_cancel(thread)); 43 ) 44 45 46 WRAPPER_FUNCTION(int, pthread_setcancelstate, 47 (int state, int *_oldState), 48 return B_TO_POSITIVE_ERROR(sReal_pthread_setcancelstate(state, _oldState)); 49 ) 50 51 52 WRAPPER_FUNCTION(int, pthread_setcanceltype, (int type, int *_oldType), 53 return B_TO_POSITIVE_ERROR(sReal_pthread_setcanceltype(type, _oldType)); 54 ) 55 56 57 WRAPPER_FUNCTION(int, pthread_getschedparam, 58 (pthread_t thread, int *policy, struct sched_param *param), 59 return B_TO_POSITIVE_ERROR(sReal_pthread_getschedparam(thread, policy, 60 param)); 61 ) 62 63 64 WRAPPER_FUNCTION(int, pthread_setschedparam, 65 (pthread_t thread, int policy, const struct sched_param *param), 66 return B_TO_POSITIVE_ERROR(sReal_pthread_setschedparam(thread, policy, 67 param)); 68 ) 69