[compiler-rt] r324126 - [asan] Make concurrent_overflow.cc less flaky
Kuba Mracek via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 2 11:49:24 PST 2018
Author: kuba.brecka
Date: Fri Feb 2 11:49:24 2018
New Revision: 324126
URL: http://llvm.org/viewvc/llvm-project?rev=324126&view=rev
Log:
[asan] Make concurrent_overflow.cc less flaky
The "sleep(5)" sometimes times out on our bots, causing the test to fail. Let's use pthread_join.
Differential Revision: https://reviews.llvm.org/D42862
Modified:
compiler-rt/trunk/test/asan/TestCases/Posix/concurrent_overflow.cc
Modified: compiler-rt/trunk/test/asan/TestCases/Posix/concurrent_overflow.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/concurrent_overflow.cc?rev=324126&r1=324125&r2=324126&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Posix/concurrent_overflow.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Posix/concurrent_overflow.cc Fri Feb 2 11:49:24 2018
@@ -20,11 +20,12 @@ static void *start_routine(void *arg) {
int main(void) {
const int n_threads = 8;
int i, counter = n_threads;
- pthread_t thread;
+ pthread_t thread[n_threads];
for (i = 0; i < n_threads; ++i)
- pthread_create(&thread, NULL, &start_routine, (void *)&counter);
- sleep(5);
+ pthread_create(&thread[i], NULL, &start_routine, (void *)&counter);
+ for (i = 0; i < n_threads; ++i)
+ pthread_join(thread[i], NULL);
return 0;
}
More information about the llvm-commits
mailing list