feat(thread): add JobSystem with parallel_for, task_group, dependencies and frame arena
- JobSystem abstraction over the existing ThreadPool worker pool; the factory in JobSystem.cpp is the single backend switch point (TBB later). - Job carries a dependency count and completion callback so a render graph can be wired on top without rewriting the scheduler. - parallel_for(first, last, body, chunk) with static partitioning, auto chunk sizing, and a join handle; task_group provides fork/join with help-execution so workers can wait without deadlocking. - Per-frame arena (beginFrame/endFrame) for frame-scoped jobs: no per-frame new/delete; frame jobs are recycled by the arena. - Thread module exposes a shared engine JobSystem (getJobSystem). - VoxelWorld::remeshDirty now uses parallel_for instead of raw std::thread. - 24 new zeroerr tests in test/thread.cpp; verified with a standalone MSVC harness (24 cases x 30 runs, no flakes).
This commit is contained in:
1 parent
9d0c35f128
commit
4a0bb51bdc
9 files changed
+1489
-28
No files matched your search
@@ -0,0 +1,19 @@
|
||||
#include "thread/JobSystem.h"
|
||||
|
||||
#include "thread/JobSystemThreadPool.h"
|
||||
|
||||
namespace eve {
|
||||
namespace thread {
|
||||
|
||||
/**
|
||||
* Backend switch point: the engine's scheduler is selected here. The default
|
||||
* implementation schedules on top of the existing ThreadPool worker pool. A
|
||||
* TBB backend only needs to implement the JobSystem/Job/TaskGroup interfaces
|
||||
* and be returned from this factory.
|
||||
*/
|
||||
JobSystem *createJobSystem(int workerCount) {
|
||||
return new JobSystemThreadPool(workerCount);
|
||||
}
|
||||
|
||||
} // namespace thread
|
||||
} // namespace eve
|
||||
Reference in new issue
Block a user