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