[TSan] Deflake test

llvm-svn: 222699
This commit is contained in:
Alexey Samsonov 2014-11-24 22:27:34 +00:00
parent 86b75a4057
commit 49a040a483
1 changed files with 3 additions and 0 deletions

View File

@ -1,10 +1,12 @@
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t 2>&1 | FileCheck %s
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
int Global;
void *Thread1(void *x) {
sleep(1);
Global++;
return NULL;
}
@ -20,6 +22,7 @@ int main() {
pthread_create(&t[1], NULL, Thread2, NULL);
pthread_join(t[0], NULL);
pthread_join(t[1], NULL);
return 0;
}
// CHECK: WARNING: ThreadSanitizer: data race