提交 b76d5a7c 编写于 作者: A Alexey Milovidov

Added a test (not gtest though)

上级 299607a3
......@@ -62,6 +62,9 @@ target_link_libraries (thread_pool_2 PRIVATE clickhouse_common_io)
add_executable (thread_pool_3 thread_pool_3.cpp)
target_link_libraries (thread_pool_3 PRIVATE clickhouse_common_io)
add_executable (thread_pool_schedule_exception thread_pool_schedule_exception.cpp)
target_link_libraries (thread_pool_schedule_exception PRIVATE clickhouse_common_io)
add_executable (multi_version multi_version.cpp)
target_link_libraries (multi_version PRIVATE clickhouse_common_io)
add_check(multi_version)
......
#include <iostream>
#include <stdexcept>
#include <Common/ThreadPool.h>
int main(int, char **)
{
ThreadPool pool(10);
pool.schedule([]{ throw std::runtime_error("Hello, world!"); });
try
{
while (true)
pool.schedule([]{}); /// An exception will be rethrown from this method.
}
catch (const std::runtime_error & e)
{
std::cerr << e.what() << "\n";
}
pool.wait();
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册