[compiler-rt] r202484 - tsan: deflake test
Dmitry Vyukov
dvyukov at google.com
Fri Feb 28 02:47:07 PST 2014
Author: dvyukov
Date: Fri Feb 28 04:47:07 2014
New Revision: 202484
URL: http://llvm.org/viewvc/llvm-project?rev=202484&view=rev
Log:
tsan: deflake test
Modified:
compiler-rt/trunk/test/tsan/cond_race.cc
Modified: compiler-rt/trunk/test/tsan/cond_race.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/cond_race.cc?rev=202484&r1=202483&r2=202484&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/cond_race.cc (original)
+++ compiler-rt/trunk/test/tsan/cond_race.cc Fri Feb 28 04:47:07 2014
@@ -5,6 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
+#include <unistd.h>
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);
}
More information about the llvm-commits
mailing list