cpp-redis / cpp_redis

C++11 Lightweight Redis client: async, thread-safe, no dependency, pipelining, multi-platform
MIT License
713 stars 198 forks source link

thread_pool::fetch_task_or_stop causes the program to pause #73

Open Eggache666 opened 3 years ago

Eggache666 commented 3 years ago

code:

try
{
    cpp_redis::client client;
    client.connect(ip, 6379, [&](const std::string& host, std::size_t port, cpp_redis::connect_state status) {});
    client.sync_commit();
    client.hgetall(key, [](const cpp_redis::reply& reply){
        throw std::runtime_error("what happend!");
    });
    client.sync_commit();
}
catch(const std::exception& e)
{
    std::cerr << e.what() << '\n';
}

when I throw an exception in the labmda expression of hgetall, it goes to line 70 (in the file thread_pool.cpp). Continue debugging, programm will pause when excute to line 124 (in the file thread_pool.cpp).

So, how can i get the exception out of the lambda expression?

platform: Windows10, VS2019-16.7.5

Thank you!