1 #include "pthread_impl.h" 2 #include "syscall.h" 3 4 #ifndef __LITEOS_A__ 5 static volatile int check_robust_result = -1; 6 #endif 7 pthread_mutexattr_setrobust(pthread_mutexattr_t * a,int robust)8int pthread_mutexattr_setrobust(pthread_mutexattr_t *a, int robust) 9 { 10 if (robust > 1U) return EINVAL; 11 if (robust) { 12 #ifndef __LITEOS_A__ 13 int r = check_robust_result; 14 if (r < 0) { 15 void *p; 16 size_t l; 17 r = -__syscall(SYS_get_robust_list, 0, &p, &l); 18 a_store(&check_robust_result, r); 19 } 20 if (r) return r; 21 #endif 22 a->__attr |= 4; 23 return 0; 24 } 25 a->__attr &= ~4; 26 return 0; 27 } 28