github.com/afumu/libc@v0.0.6/musl/src/thread/pthread_attr_get.c (about) 1 #include "pthread_impl.h" 2 3 int __ccgo_pthreadAttrGetDetachState(pthread_attr_t *a) { 4 return a->_a_detach; 5 } 6 7 int pthread_attr_getdetachstate(const pthread_attr_t *a, int *state) 8 { 9 *state = a->_a_detach; 10 return 0; 11 } 12 // 13 // int pthread_attr_getguardsize(const pthread_attr_t *restrict a, size_t *restrict size) 14 // { 15 // *size = a->_a_guardsize; 16 // return 0; 17 // } 18 // 19 // int pthread_attr_getinheritsched(const pthread_attr_t *restrict a, int *restrict inherit) 20 // { 21 // *inherit = a->_a_sched; 22 // return 0; 23 // } 24 // 25 // int pthread_attr_getschedparam(const pthread_attr_t *restrict a, struct sched_param *restrict param) 26 // { 27 // param->sched_priority = a->_a_prio; 28 // return 0; 29 // } 30 // 31 // int pthread_attr_getschedpolicy(const pthread_attr_t *restrict a, int *restrict policy) 32 // { 33 // *policy = a->_a_policy; 34 // return 0; 35 // } 36 // 37 // int pthread_attr_getscope(const pthread_attr_t *restrict a, int *restrict scope) 38 // { 39 // *scope = PTHREAD_SCOPE_SYSTEM; 40 // return 0; 41 // } 42 // 43 // int pthread_attr_getstack(const pthread_attr_t *restrict a, void **restrict addr, size_t *restrict size) 44 // { 45 // if (!a->_a_stackaddr) 46 // return EINVAL; 47 // *size = a->_a_stacksize; 48 // *addr = (void *)(a->_a_stackaddr - *size); 49 // return 0; 50 // } 51 // 52 // int pthread_attr_getstacksize(const pthread_attr_t *restrict a, size_t *restrict size) 53 // { 54 // *size = a->_a_stacksize; 55 // return 0; 56 // } 57 // 58 // int pthread_barrierattr_getpshared(const pthread_barrierattr_t *restrict a, int *restrict pshared) 59 // { 60 // *pshared = !!a->__attr; 61 // return 0; 62 // } 63 // 64 // int pthread_condattr_getclock(const pthread_condattr_t *restrict a, clockid_t *restrict clk) 65 // { 66 // *clk = a->__attr & 0x7fffffff; 67 // return 0; 68 // } 69 // 70 // int pthread_condattr_getpshared(const pthread_condattr_t *restrict a, int *restrict pshared) 71 // { 72 // *pshared = a->__attr>>31; 73 // return 0; 74 // } 75 // 76 // int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict a, int *restrict protocol) 77 // { 78 // *protocol = PTHREAD_PRIO_NONE; 79 // return 0; 80 // } 81 // int pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict a, int *restrict pshared) 82 // { 83 // *pshared = a->__attr / 128U % 2; 84 // return 0; 85 // } 86 // 87 // int pthread_mutexattr_getrobust(const pthread_mutexattr_t *restrict a, int *restrict robust) 88 // { 89 // *robust = a->__attr / 4U % 2; 90 // return 0; 91 // } 92 93 int __ccgo_pthreadMutexattrGettype(const pthread_mutexattr_t *restrict a) 94 { 95 return a->__attr & 3; 96 } 97 98 // int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict a, int *restrict type) 99 // { 100 // *type = a->__attr & 3; 101 // return 0; 102 // } 103 // 104 // int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *restrict a, int *restrict pshared) 105 // { 106 // *pshared = a->__attr[0]; 107 // return 0; 108 // }