1 | // REQUIRES: sunrpc |
2 | |
3 | // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s |
4 | |
5 | #include <pthread.h> |
6 | #include <rpc/types.h> |
7 | #include <rpc/xdr.h> |
8 | #include <stdio.h> |
9 | |
10 | void *thr(void *p) { |
11 | XDR xdrs; |
12 | char buf[100]; |
13 | xdrmem_create(&xdrs, buf, sizeof(buf), XDR_ENCODE); |
14 | xdr_destroy(&xdrs); |
15 | return 0; |
16 | } |
17 | |
18 | int main(int argc, char *argv[]) { |
19 | pthread_t th[2]; |
20 | pthread_create(newthread: &th[0], attr: 0, start_routine: thr, arg: 0); |
21 | pthread_create(newthread: &th[1], attr: 0, start_routine: thr, arg: 0); |
22 | pthread_join(th: th[0], thread_return: 0); |
23 | pthread_join(th: th[1], thread_return: 0); |
24 | fprintf(stderr, format: "DONE\n" ); |
25 | // CHECK: DONE |
26 | return 0; |
27 | } |
28 | |