]> git.proxmox.com Git - rustc.git/blob - src/libcompiler_builtins/compiler-rt/test/sanitizer_common/TestCases/pthread_mutexattr_get.cc
New upstream version 1.20.0+dfsg1
[rustc.git] / src / libcompiler_builtins / compiler-rt / test / sanitizer_common / TestCases / pthread_mutexattr_get.cc
1 // RUN: %clangxx -O0 %s -o %t && %run %t
2
3 #include <assert.h>
4 #include <pthread.h>
5
6 int main(void) {
7 pthread_mutexattr_t ma;
8 int res = pthread_mutexattr_init(&ma);
9 assert(res == 0);
10 res = pthread_mutexattr_setpshared(&ma, 1);
11 assert(res == 0);
12 int pshared;
13 res = pthread_mutexattr_getpshared(&ma, &pshared);
14 assert(res == 0);
15 assert(pshared == 1);
16 res = pthread_mutexattr_destroy(&ma);
17 assert(res == 0);
18 return 0;
19 }