fix arm __a_barrier_oldkuser when built as thumb
[musl] / src / thread / pthread_mutexattr_setrobust.c
1 #include "pthread_impl.h"
2 #include "syscall.h"
3
4 static pthread_once_t check_robust_once;
5 static int check_robust_result;
6
7 static void check_robust()
8 {
9         void *p;
10         size_t l;
11         check_robust_result = -__syscall(SYS_get_robust_list, 0, &p, &l);
12 }
13
14 int pthread_mutexattr_setrobust(pthread_mutexattr_t *a, int robust)
15 {
16         if (robust > 1U) return EINVAL;
17         if (robust) {
18                 pthread_once(&check_robust_once, check_robust);
19                 if (check_robust_result) return check_robust_result;
20                 a->__attr |= 4;
21                 return 0;
22         }
23         a->__attr &= ~4;
24         return 0;
25 }