1 // RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && %run %t
3 // Regression test for a deadlock in pthread_getattr_np
7 #if defined(__FreeBSD__)
8 #include <pthread_np.h>
11 void *ThreadFn(void *) {
13 #if defined(__FreeBSD__)
14 // On FreeBSD it needs to allocate attr underlying memory
15 int res
= pthread_attr_init(&attr
);
17 res
= pthread_attr_get_np(pthread_self(), &attr
);
19 int res
= pthread_getattr_np(pthread_self(), &attr
);
27 int res
= pthread_create(&t
, 0, ThreadFn
, 0);
29 res
= pthread_join(t
, 0);