-
Notifications
You must be signed in to change notification settings - Fork 244
Task system: Send incoming tasks directly to waiting executors #7315
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
Task system: Send incoming tasks directly to waiting executors #7315
Conversation
…_consumers_directly2
…tem_feed_consumers_directly2
…tem_feed_consumers_directly2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Introduces a redesigned task execution system to route tasks directly to waiting worker threads, removes the IJobBoard interface, and centralizes delayed/periodic scheduling within JobBoard. Key changes:
- Replaces IJobBoard with concrete JobBoard offering wait-based task dispatch, delayed/periodic scheduling, and summary reporting.
- Adds ThreadManager for dynamic worker management and updates tests to use new APIs (set_worker_count, JobBoard::tick, get_summary).
- Standardizes task/action naming to return const std::string&, eliminating transient string_view returns.
Reviewed Changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tasks/worker.h | Adds worker loop using timed waits on JobBoard. |
| src/tasks/thread_manager.{h,cpp} | Introduces ThreadManager for managing pooled worker threads. |
| src/tasks/job_board.{h,cpp} | Reimplements JobBoard with direct worker notification, delayed/periodic task handling, and summary API. |
| src/tasks/task_system.{h,cpp} | Simplifies global API; delegates scheduling to JobBoard and worker mgmt to ThreadManager. |
| src/tasks/task.h | Changes get_name() to pure virtual returning const std::string&. |
| src/tasks/basic_task.h | Adjusts BasicTask naming and get_name signature. |
| src/tasks/ordered_tasks.{h,cpp} | Updates constructor/API to use concrete JobBoard and rvalue name handling. |
| src/tasks/fan_in_tasks.{h,cpp} | Removes custom naming; uses concrete JobBoard. |
| Tests (multiple files) | Adapted to new APIs (summary checks, periodic/delayed handling moved to JobBoard instance). |
| Bench files | Updated task name accessors to return const std::string&. |
| CMakeLists.txt | Adds new source (thread_manager.cpp) and new test file (tasks_api.cpp). |
| .clang-tidy | Disables additional CERT concurrency checks. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
- Overzealous type replacement - Implicit include - Redefined default name
This PR contains some follow-up cleanups from the discussion in #7269:
const std::string&from theget_namecalls to avoid any additional copies. The name is generally per-type, can opt in to per-instance where appropriate, in either case it should be formatted/constructed eagerly..empty()method. Replaced by aget_summary()returning some basic stats about the current queue state.IJobBoardand clarifying which tests (most) are testing a localJobBoardvs the global staticccf::tasks.Also a perf improvement - rather than gluing together discrete
condition_variableand locked queue (taking 2 separate mutexes in sequence) we use acondition_variablewait for workers to pause directly on the work queue.