Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tsr-boxbot opened this issue Feb 25, 2025 · 0 comments
Open

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

tsr-boxbot opened this issue Feb 25, 2025 · 0 comments

Comments

@tsr-boxbot
Copy link

tsr-boxbot commented Feb 25, 2025

Sorry if this isn't the right place for boost issues. Please close if this should go somewhere else.


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:

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant