boostorg / boostorg/asio

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

Abierto
#443 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
C++
Estrellas
1.6k
Forks
485
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.