diff options
Diffstat (limited to 'test/tsan/inlined_memcpy_race.cc')
-rw-r--r-- | test/tsan/inlined_memcpy_race.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/test/tsan/inlined_memcpy_race.cc b/test/tsan/inlined_memcpy_race.cc index a95576a83c9a5..e3ed07abcf890 100644 --- a/test/tsan/inlined_memcpy_race.cc +++ b/test/tsan/inlined_memcpy_race.cc @@ -1,24 +1,23 @@ // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s -#include <pthread.h> -#include <stddef.h> -#include <stdio.h> +#include "test.h" #include <string.h> -#include <unistd.h> int x[4], z[4]; void *MemCpyThread(void *a) { memcpy((int*)a, z, 16); + barrier_wait(&barrier); return NULL; } void *MemSetThread(void *a) { - sleep(1); + barrier_wait(&barrier); memset((int*)a, 0, 16); return NULL; } int main() { + barrier_init(&barrier, 2); pthread_t t[2]; // Race on x between memcpy and memset pthread_create(&t[0], NULL, MemCpyThread, x); |