boostorg / boostorg/asio

thread_pool::wait doesn't appear to do what it says it does

未关闭
#443 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C++
星标
1.6k
派生
485
PR 合并指标
30 天内没有已合并 PR

描述

Hi, I'm trying to understand the behavior of `thread_pool::wait`, the documentation (Boost 1.83) says:

This function blocks until the threads in the pool have completed. If stop() is not called prior to wait(), the wait() call will wait until the pool has no more outstanding work.

Source: https://www.boost.org/doc/libs/1_83_0/doc/html/boost_asio/reference/thread_pool/wait.html

If I have something like:

```cpp
boost::asio::thread_pool thread_pool(10);
...
boost::asio::post(thread_pool_, task0);
....
thread_pool.wait(); //stop was not called so should just wait until the pool has no more outstanding work.
boost::asio::post(thread_pool_, task9999); // hangs forever
```

Since I didn't call `stop` I would expect to be able to post more things to the pool but it appears `wait` actually shutdowns the pool even if `stop` was not called.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。