]> git.proxmox.com Git - rustc.git/blobdiff - src/compiler-rt/test/tsan/tls_race.cc
Imported Upstream version 1.6.0+dfsg1
[rustc.git] / src / compiler-rt / test / tsan / tls_race.cc
index dbfc5531b190b08f6dd52e8acd1843b987aa39c8..5e81722767089d913515b832328f8524bcf0894f 100644 (file)
@@ -1,19 +1,19 @@
-// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
-#include <pthread.h>
-#include <stddef.h>
-#include <unistd.h>
+// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
+#include "test.h"
 
 void *Thread(void *a) {
-  sleep(1);
+  barrier_wait(&barrier);
   *(int*)a = 43;
   return 0;
 }
 
 int main() {
+  barrier_init(&barrier, 2);
   static __thread int Var = 42;
   pthread_t t;
   pthread_create(&t, 0, Thread, &Var);
   Var = 43;
+  barrier_wait(&barrier);
   pthread_join(t, 0);
 }