Skip to content

Add a QThreadPoolExecutor which uses a QThreadPool object #150

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

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

kristjanvalur
Copy link
Contributor

@kristjanvalur kristjanvalur commented Aug 15, 2025

It can be useful, when using loop.run_in_scheduler(), to simply use the pre-existing pool of QThread objects.
A global instance of QThreadPool exists in the application, and so this is typically faster than creating a QThreadExecutor instance, with a fixed number of new threads.

  • A new QThreadPoolExecutor class is created. It can take a QThreadPool object as the underlying pool or use the global thread pool otherwise.
  • A QThreadExecutorBase class becomes the parent of both QThreadExecutor and QThreadPoolExecutor.
  • add the required map() method, using the underlying submit().
  • Update signature of the shutdown() method, supporting the cancel_futures argument.
  • Add various unit tests.

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

Successfully merging this pull request may close these issues.

1 participant