Adapted test for TSan #4572

This commit is contained in:
Alexey Milovidov 2019-03-06 21:09:25 +03:00
parent 41469cc874
commit 47df38f7a0

View File

@ -1,4 +1,4 @@
#include <atomic> #include <mutex>
#include <iostream> #include <iostream>
#include <Common/ThreadPool.h> #include <Common/ThreadPool.h>
@ -10,8 +10,9 @@ void test()
{ {
Pool pool(10, 2, 10); Pool pool(10, 2, 10);
std::mutex mutex;
for (size_t i = 0; i < 10; ++i) for (size_t i = 0; i < 10; ++i)
pool.schedule([]{ std::cerr << '.'; }); pool.schedule([&]{ std::lock_guard lock(mutex); std::cerr << '.'; });
pool.wait(); pool.wait();
} }