Skip to content

docs: describe thread_pool shutdown accurately - #458

Merged
sgerbino merged 1 commit into
cppalliance:developfrom
mvandeberg:pr/404-thread-pool-dtor-docs
Oct 21, 2026
Merged

sgerbino merged 1 commit into
cppalliance:developfrom
mvandeberg:pr/404-thread-pool-dtor-docs

Conversation

@mvandeberg

Copy link
Copy Markdown
Contributor

Rewrite the ~thread_pool documentation. It gives the steps in order: stop the pool, join the worker threads, then shut down the services and abandon the queued work. The destructor does not wait for outstanding work. Each abandoned chain unwinds on the executor of the coroutine that started it. The documentation also gives the relation to join(). Add a precondition: a thread of the pool must not destroy the pool.

Correct these other statements in thread_pool.hpp:

  • The destructor precondition names only run_async. The run function does not add outstanding work to the pool.
  • join() has no internal work guard to release.
  • A join() call that occurs while another join() call blocks returns immediately. Only the first call joins the threads.
  • post() does not run a continuation after the pool stops. The destructor abandons it. dispatch() does the same when it posts.
  • post() and dispatch() can throw std::system_error when they start the worker threads. Then the continuation is not queued.
  • The executor_type brief gives what the class does.

Correct two example comments and the allocators page. The destructor abandons queued work. It does not discard it. pool.join() does not release the task frames. It returns after the task releases them.

Closes #404

@cppalliance-bot

cppalliance-bot commented Oct 17, 2026 •

Copy link
Copy Markdown

An automated preview of the documentation is available at https://458.capy.prtest3.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-10-20 20:09:17 UTC

@cppalliance-bot

cppalliance-bot commented Oct 17, 2026 •

Copy link
Copy Markdown

GCOVR code coverage report https://458.capy.prtest3.cppalliance.org/gcovr/index.html
LCOV code coverage report https://458.capy.prtest3.cppalliance.org/genhtml/index.html
Coverage Diff Report https://458.capy.prtest3.cppalliance.org/diff-report/index.html

Build time: 2026-10-20 20:34:22 UTC

@codecov

codecov Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.47%. Comparing base (bb749f9) to head (189986e).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #458   +/-   ##
========================================
  Coverage    98.47%   98.47%           
========================================
  Files          137      137           
  Lines         7293     7293           
========================================
  Hits          7182     7182           
  Misses         111      111           
Flag Coverage Δ
linux 98.46% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
include/boost/capy/ex/thread_pool.hpp 100.00% <ø> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bb749f9...189986e. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Rewrite the ~thread_pool documentation. It gives the steps in order:
stop the pool, join the worker threads, then shut down the services
and abandon the queued work. The destructor does not wait for
outstanding work. Each abandoned chain unwinds on the executor of the
coroutine that started it. The documentation also gives the relation
to join(). Add a precondition: a thread of the pool must not destroy
the pool.

Correct these other statements in thread_pool.hpp:

- The destructor precondition names only run_async. The run function
  does not add outstanding work to the pool. The precondition also
  tells the user not to call stop(), because join() then does not
  wait for outstanding work.
- join() has no internal work guard to release.
- A join() call that occurs while another join() call blocks returns
  immediately. Only the first call joins the threads.
- post() does not run a continuation after the pool stops. The
  destructor abandons it. dispatch() does the same when it posts.
- post() and dispatch() can throw std::system_error when they start
  the worker threads. Then the continuation is not queued.
- The executor_type brief gives what the class does.

Correct two example comments and the allocators page. The destructor
abandons queued work. It does not discard it. pool.join() does not
release the task frames. It returns after the task releases them.

Closes cppalliance#404
@mvandeberg
mvandeberg force-pushed the pr/404-thread-pool-dtor-docs branch from 72bfccb to 189986e Compare October 20, 2026 20:02
@sgerbino
sgerbino merged commit d514ce5 into cppalliance:develop Oct 21, 2026
41 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Beast2 Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

docs: reconcile thread_pool destructor reference wording with the manual

3 participants