Skip to content

Commit

Permalink
minor unit test code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dspeterson committed Jan 24, 2016
1 parent 77d657a commit beecbab
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions src/thread/managed_thread_pool.test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -649,14 +649,13 @@ namespace {
w.Launch();
}

for (size_t i = 0; (i < 60) && working_count.load(); ++i) {
sleep(1);
}

for (size_t i = 0; (i < 60); ++i) {
/* Hopefully 600 seconds will be long enough for the test to finish, even
on a slow machine. */
for (size_t i = 0; (i < 600); ++i) {
TManagedThreadPoolBase::TStats stats = pool.GetStats();

if ((stats.IdleWorkerCount == stats.LiveWorkerCount) &&
if ((working_count.load() == 0) &&
(stats.IdleWorkerCount == stats.LiveWorkerCount) &&
(stats.FinishWorkCount == counter.load())) {
break;
}
Expand Down Expand Up @@ -708,14 +707,11 @@ namespace {

/* Hopefully 600 seconds will be long enough for the test to finish, even
on a slow machine. */
for (size_t i = 0; (i < 600) && working_count.load(); ++i) {
sleep(1);
}

for (size_t i = 0; (i < 60); ++i) {
for (size_t i = 0; (i < 600); ++i) {
TManagedThreadPoolBase::TStats stats = pool.GetStats();

if ((stats.IdleWorkerCount == stats.LiveWorkerCount) &&
if ((working_count.load() == 0) &&
(stats.IdleWorkerCount == stats.LiveWorkerCount) &&
(stats.FinishWorkCount == counter.load())) {
break;
}
Expand Down Expand Up @@ -759,14 +755,11 @@ namespace {

/* Hopefully 600 seconds will be long enough for the test to finish, even
on a slow machine. */
for (size_t i = 0; (i < 600) && working_count.load(); ++i) {
sleep(1);
}

for (size_t i = 0; (i < 60); ++i) {
for (size_t i = 0; (i < 600); ++i) {
stats = pool.GetStats();

if ((stats.IdleWorkerCount == stats.LiveWorkerCount) &&
if ((working_count.load() == 0) &&
(stats.IdleWorkerCount == stats.LiveWorkerCount) &&
(stats.FinishWorkCount == counter.load())) {
break;
}
Expand Down

0 comments on commit beecbab

Please sign in to comment.