| 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(attr: &ma); |
| 12 | assert(res == 0); |
| 13 | res = pthread_mutexattr_setpshared(attr: &ma, pshared: 1); |
| 14 | assert(res == 0); |
| 15 | int pshared; |
| 16 | res = pthread_mutexattr_getpshared(attr: &ma, pshared: &pshared); |
| 17 | assert(res == 0); |
| 18 | assert(pshared == 1); |
| 19 | res = pthread_mutexattr_destroy(attr: &ma); |
| 20 | assert(res == 0); |
| 21 | return 0; |
| 22 | } |
| 23 |
