28 lines · cpp
1// REQUIRES: sunrpc2 3// RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s4 5#include <pthread.h>6#include <rpc/types.h>7#include <rpc/xdr.h>8#include <stdio.h>9 10void *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 18int main(int argc, char *argv[]) {19 pthread_t th[2];20 pthread_create(&th[0], 0, thr, 0);21 pthread_create(&th[1], 0, thr, 0);22 pthread_join(th[0], 0);23 pthread_join(th[1], 0);24 fprintf(stderr, "DONE\n");25 // CHECK: DONE26 return 0;27}28