summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-11-09 12:30:50 -0800
committerMathieu Chartier <mathieuc@google.com>2014-11-09 12:30:50 -0800
commit7947b544d2e716be16f7d9a5324a436b901780f7 (patch)
treef57e368209e55a91c52d6bb552c131afa2a5e9d8
parentd45f76e59bf8342491ca02d64721537e06c79f43 (diff)
downloadart-7947b544d2e716be16f7d9a5324a436b901780f7.zip
art-7947b544d2e716be16f7d9a5324a436b901780f7.tar.gz
art-7947b544d2e716be16f7d9a5324a436b901780f7.tar.bz2
Fix thread pool test valgrind flakiness
The test used to use the counters to see when the tasks were done but since the counter is incremented before finalize was called, the test would sometimes finish before the objects were freed. This resulted in valgrind leaks. Change-Id: I6dc3cf6a155cde3af5d06b1416773a6ae6f2a6e6
-rw-r--r--runtime/thread_pool_test.cc6
1 files changed, 1 insertions, 5 deletions
diff --git a/runtime/thread_pool_test.cc b/runtime/thread_pool_test.cc
index 4bd44dc..d5f17d1 100644
--- a/runtime/thread_pool_test.cc
+++ b/runtime/thread_pool_test.cc
@@ -95,11 +95,7 @@ TEST_F(ThreadPoolTest, StopStart) {
EXPECT_EQ(0, bad_count.LoadSequentiallyConsistent());
// Allow tasks to finish up and delete themselves.
thread_pool.StartWorkers(self);
- while (count.LoadSequentiallyConsistent() != num_tasks &&
- bad_count.LoadSequentiallyConsistent() != 1) {
- usleep(200);
- }
- thread_pool.StopWorkers(self);
+ thread_pool.Wait(self, false, false);
}
class TreeTask : public Task {