summaryrefslogtreecommitdiff
path: root/test/sanitizer_common/TestCases/pthread_mutexattr_get.cc
blob: 742ae72c41b41e087d297857e94a653fd250efbd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// RUN: %clangxx -O0 %s -o %t && %run %t

// pthread_mutexattr_setpshared and pthread_mutexattr_getpshared unavailable
// UNSUPPORTED: netbsd

#include <assert.h>
#include <pthread.h>

int main(void) {
  pthread_mutexattr_t ma;
  int res = pthread_mutexattr_init(&ma);
  assert(res == 0);
  res = pthread_mutexattr_setpshared(&ma, 1);
  assert(res == 0);
  int pshared;
  res = pthread_mutexattr_getpshared(&ma, &pshared);
  assert(res == 0);
  assert(pshared == 1);
  res = pthread_mutexattr_destroy(&ma);
  assert(res == 0);
  return 0;
}