From 371639ea1f0b4e9c3c16a2d5562c993eac2749cf Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 28 Feb 2014 10:47:07 +0000 Subject: [PATCH] tsan: deflake test llvm-svn: 202484 --- compiler-rt/test/tsan/cond_race.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler-rt/test/tsan/cond_race.cc b/compiler-rt/test/tsan/cond_race.cc index 1e2acb243279..de9f18d21941 100644 --- a/compiler-rt/test/tsan/cond_race.cc +++ b/compiler-rt/test/tsan/cond_race.cc @@ -5,6 +5,7 @@ #include #include #include +#include struct Ctx { pthread_mutex_t m; @@ -31,6 +32,8 @@ int main() { while (!c->done) pthread_cond_wait(&c->c, &c->m); pthread_mutex_unlock(&c->m); + // w/o this sleep, it can be reported as use-after-free + sleep(1); delete c; pthread_join(th, 0); }