1
0
mirror of https://github.com/facebook/zstd.git synced 2025-07-14 11:14:18 +02:00

[pzstd] Add logging statements to tests

This commit is contained in:
Nick Terrell
2017-04-27 09:55:19 -07:00
parent 9a7698c1f0
commit 0bd5d25d02
2 changed files with 12 additions and 1 deletions

View File

@ -10,6 +10,7 @@
#include <gtest/gtest.h>
#include <atomic>
#include <iostream>
#include <thread>
#include <vector>
@ -34,16 +35,19 @@ TEST(ThreadPool, AllJobsFinished) {
std::atomic<unsigned> numFinished{0};
std::atomic<bool> start{false};
{
std::cerr << "Creating executor" << std::endl;
ThreadPool executor(5);
for (int i = 0; i < 10; ++i) {
executor.add([ &numFinished, &start ] {
while (!start.load()) {
// spin
std::this_thread::yield();
}
++numFinished;
});
}
std::cerr << "Starting" << std::endl;
start.store(true);
std::cerr << "Finishing" << std::endl;
}
EXPECT_EQ(10, numFinished.load());
}