【发布时间】:2019-07-11 11:27:42
【问题描述】:
我同时向 boost::asio::thread_pool 提交了多个任务。但是官方文档并没有谈到 boost::asio::thread_pool 的线程安全。
boost 库版本是 1.69。我的代码如下:
/*define a thread pool*/
boost::asio::thread_pool pool(4);
//on thread 1
boost::asio::post(pool, my_task_1);
...
//on thread 2
boost::asio::post(pool, my_task_2);
所以我想知道代码是否可以在多个线程上工作
【问题讨论】:
标签: c++ boost thread-safety asio