beyond-all-reason / beyond-all-reason/RecoilEngine
Feature Request: Threadpool returning sortable vectors
- Dominant language
- C++
- Stars
- 679
- Forks
- 290
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 40
Description
In my mind, it sounds like it could be a fun addition to have a for_mt function that would take struct vector type argument, and do work on some iterable, and return the results of each thread in a separate vector. Optionally, as a last step, each thread could sort its own vector, with the final mergesort of all vectors of each thread being hopefully less taxing given each thread is already sorted.
Here is the engine implementation of the current for_mt stuff:
https://github.com/beyond-all-reason/spring/blob/BAR105/rts/System/Threading/ThreadPool.cpp
In my simple mind, it would work like this:

Contributor guide
Research direction
Start by reading rts/System/Threading/ThreadPool.cpp and the existing for_mt implementation. Clarify the proposed API, per-thread vector ownership, optional sorting, and final merge behavior before changing the thread-pool design. Done means the feature's scope and behavior are agreed and the implementation is validated against the existing thread-pool use cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100