为什么会出现io_context do_one()运行时崩溃?

时间:2019-06-18 08:08:49

标签: boost-asio

这是我的信号处理程序:

SignalHandler::SignalHandler(boost::asio::io_context & context) : _context(context), _signals(context, SIGINT, SIGTERM)
{
    _signals.async_wait(std::bind(&SignalHandler::HandleTermSignal, this, std::placeholders::_1, std::placeholders::_2));
}

当我运行此代码时:

SignalHandler signalHandler(io);
std::thread t([&signalHandler]() {
    signalHandler.HandleInput();
});
boost::system::error_code errcode;
try {
    io.run(errcode);
    logger->info(PACK("err:{}"), errcode.message());
} catch (std::exception& e) {
    logger->critical(PACK("Exception Catched : {}, err:{}"),e.what(), errcode.message());
}
t.join();

我得到此呼叫跟踪:

QuoteSvr.exe!boost::asio::detail::win_iocp_io_context::do_one(unsigned long msec, boost::system::error_code & ec) Ln 420 C++
QuoteSvr.exe!boost::asio::detail::win_iocp_io_context::run(boost::system::error_code & ec) Ln 202 C++
QuoteSvr.exe!boost::asio::io_context::run(boost::system::error_code & ec) Ln72 C++
QuoteSvr.exe!main(int argc, char * * argv) Ln 170 C++

0 个答案:

没有答案