Debian Codegraph @

compiler-rt/test/sanitizer_common/TestCases/pthread_mutexattr_get.cpp

raw
1 // RUN: %clangxx -O0 %s -o %t && %run %t
2
3 // pthread_mutexattr_setpshared and pthread_mutexattr_getpshared unavailable
4 // UNSUPPORTED: target={{.*netbsd.*}}
5
6 #include <assert.h>
7 #include <pthread.h>
8
9 int main(void) {
10 pthread_mutexattr_t ma;
11 int res = pthread_mutexattr_init(&ma);
12 assert(res == 0);
13 res = pthread_mutexattr_setpshared(&ma, 1);
14 assert(res == 0);
15 int pshared;
16 res = pthread_mutexattr_getpshared(&ma, &pshared);
17 assert(res == 0);
18 assert(pshared == 1);
19 res = pthread_mutexattr_destroy(&ma);
20 assert(res == 0);
21 return 0;
22 }