Skip to content

Commit

Permalink
[asan] Make concurrent_overflow.cc less flaky
Browse files Browse the repository at this point in the history
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

llvm-svn: 324126
  • Loading branch information
kubamracek committed Feb 2, 2018
1 parent 58eb183 commit 66ce451
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions compiler-rt/test/asan/TestCases/Posix/concurrent_overflow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 66ce451

Please sign in to comment.