I'm using async hiredis with libev. mLoopThread is used here for ev loop thread, basically mLoopThread is calling ev_loop(). when main thread tries to destruct async hiredis instance, it calls ev_unloop to try to make ev_loop() exit. The code looks as below. But this is not working. backtrace shows mLoopThread is hanging in epoll_wait(), and main thread is hanging in mLoopThread->join(). How to exit ev loop thread? Thanks.
~async_redis() {
ev_unloop(mLoop, EVBREAK_ALL);
if (mLoopThread && mLoopThread->joinable()) {
mLoopThread->join();
}
}