[TSan] Deflake test
authorAlexey Samsonov <vonosmas@gmail.com>
Mon, 24 Nov 2014 22:27:34 +0000 (22:27 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Mon, 24 Nov 2014 22:27:34 +0000 (22:27 +0000)
llvm-svn: 222699

compiler-rt/test/tsan/simple_race.cc

index 0236b9f..f711bb5 100644 (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