From 47df38f7a05c184a8e5b870ff05ec481d2a5ffc8 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Wed, 6 Mar 2019 21:09:25 +0300 Subject: [PATCH] Adapted test for TSan #4572 --- dbms/src/Common/tests/thread_pool_3.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dbms/src/Common/tests/thread_pool_3.cpp b/dbms/src/Common/tests/thread_pool_3.cpp index 687c344288d..924895de308 100644 --- a/dbms/src/Common/tests/thread_pool_3.cpp +++ b/dbms/src/Common/tests/thread_pool_3.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include @@ -10,8 +10,9 @@ void test() { Pool pool(10, 2, 10); + std::mutex mutex; for (size_t i = 0; i < 10; ++i) - pool.schedule([]{ std::cerr << '.'; }); + pool.schedule([&]{ std::lock_guard lock(mutex); std::cerr << '.'; }); pool.wait(); }