Skip to content

docs: describe thread_pool shutdown accurately - #458

Open
mvandeberg wants to merge 1 commit into
cppalliance:developfrom
mvandeberg:pr/404-thread-pool-dtor-docs
Open

mvandeberg wants to merge 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

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 cppalliance#404
@cppalliance-bot

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-17 19:24:09 UTC

@cppalliance-bot

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-17 19:37:00 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.45%. Comparing base (ef63862) to head (72bfccb).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #458      +/-   ##
===========================================
+ Coverage    98.43%   98.45%   +0.01%     
===========================================
  Files          137      137              
  Lines         7297     7297              
===========================================
+ Hits          7183     7184       +1     
+ Misses         114      113       -1     
Flag Coverage Δ
linux 98.40% <ø> (ø)

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 2 files 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 ef63862...72bfccb. Read the comment docs.

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

docs: reconcile thread_pool destructor reference wording with the manual

2 participants