diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-02-10 07:45:43 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-02-10 07:45:43 +0000 |
commit | 476c4db3dc56bee43df384704c75ccc71cfa7a1d (patch) | |
tree | 5d0dcec3cc12fc53532fc84029892b98711a2596 /test/tsan/global_race.cc | |
parent | ca9211ecdede9bdedb812b2243a4abdb8dacd1b9 (diff) | |
download | src-476c4db3dc56bee43df384704c75ccc71cfa7a1d.tar.gz src-476c4db3dc56bee43df384704c75ccc71cfa7a1d.zip |
Import compiler-rt trunk r228651.vendor/compiler-rt/compiler-rt-r228651
Notes
Notes:
svn path=/vendor/compiler-rt/dist/; revision=278497
svn path=/vendor/compiler-rt/compiler-rt-r228651/; revision=278498; tag=vendor/compiler-rt/compiler-rt-r228651
Diffstat (limited to 'test/tsan/global_race.cc')
-rw-r--r-- | test/tsan/global_race.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/test/tsan/global_race.cc b/test/tsan/global_race.cc index e12bb1d220f8..d70bee4a556b 100644 --- a/test/tsan/global_race.cc +++ b/test/tsan/global_race.cc @@ -1,24 +1,23 @@ // RUN: %clangxx_tsan -O1 %s -o %T/global_race.cc.exe && %deflake %run %T/global_race.cc.exe | FileCheck %s -#include <pthread.h> -#include <stdio.h> -#include <stddef.h> -#include <unistd.h> +#include "test.h" int GlobalData[10]; void *Thread(void *a) { - sleep(1); + barrier_wait(&barrier); GlobalData[2] = 42; return 0; } int main() { + barrier_init(&barrier, 2); // On FreeBSD, the %p conversion specifier works as 0x%x and thus does not // match to the format used in the diagnotic message. fprintf(stderr, "addr=0x%012lx\n", (unsigned long) GlobalData); pthread_t t; pthread_create(&t, 0, Thread, 0); GlobalData[2] = 43; + barrier_wait(&barrier); pthread_join(t, 0); } |