diff options
Diffstat (limited to 'test/tsan/mop_with_offset.cc')
-rw-r--r-- | test/tsan/mop_with_offset.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/test/tsan/mop_with_offset.cc b/test/tsan/mop_with_offset.cc index e44c78b7d1b44..c67e81e09cda9 100644 --- a/test/tsan/mop_with_offset.cc +++ b/test/tsan/mop_with_offset.cc @@ -1,23 +1,22 @@ // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s -#include <pthread.h> -#include <stddef.h> -#include <stdio.h> -#include <unistd.h> +#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); |