]> git.proxmox.com Git - rustc.git/blobdiff - src/compiler-rt/test/tsan/mop_with_offset.cc
Imported Upstream version 1.6.0+dfsg1
[rustc.git] / src / compiler-rt / test / tsan / mop_with_offset.cc
index e9342794d7df7d29106470467ebfb21eebd94fb2..c67e81e09cda9a1d765b247fe9b266ebfdbb113a 100644 (file)
@@ -1,23 +1,22 @@
-// RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
-#include <pthread.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <unistd.h>
+// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
+#include "test.h"
 
 void *Thread1(void *x) {
   int *p = (int*)x;
   p[0] = 1;
+  barrier_wait(&barrier);
   return NULL;
 }
 
 void *Thread2(void *x) {
-  sleep(1);
+  barrier_wait(&barrier);
   char *p = (char*)x;
   p[2] = 1;
   return NULL;
 }
 
 int main() {
+  barrier_init(&barrier, 2);
   int *data = new int(42);
   fprintf(stderr, "ptr1=%p\n", data);
   fprintf(stderr, "ptr2=%p\n", (char*)data + 2);