io_context.run() in a separate thread blocks

后端 未结 1 893
隐瞒了意图╮
隐瞒了意图╮ 2021-01-24 02:09

I have a RESTServer.hpp implemented using boost.beast as shown below.

#pragma once

#include 
#include &l         


        
相关标签:
1条回答
  • 2021-01-24 03:12

    You're calling run in both the thread

    m_threads.emplace_back(boost::bind(&boost::asio::io_context::run, &m_ioc));
    

    and the google test thread

    m_ioc.run();
    

    which is causing the Setup to block. Try removing m_ioc.run(); since you are already spawning a thread to call io_context::run.

    0 讨论(0)
提交回复
热议问题