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
1 file changed