6 Commits
Author SHA1 Message Date
西风逍遥游 a8b8e83128 refactor: consolidate engine architecture contracts 2026-08-27 12:54:48 +08:00
西风逍遥游 fb42efcc5f fix(thread): close JobSystem releaseDependents use-after-free
ASan (Linux CI) caught a heap-use-after-free in
JobSystemThreadPool::releaseDependents (voxel.world.cross_chunk_seam_culled):
completeJob set completionDone=true and released the mutex, then iterated
job->dependents. A waiter could acquire the mutex in between, see
completionDone, return from wait() and delete the heap job (owned by the
caller), freeing the dependents vector mid-iteration.

Move releaseDependents inside the same critical section and set
completionDone last, so no waiter can observe completion before the
dependents are released. Add a stress regression test that waits on a
completed child and deletes it immediately, 200 iterations.
2026-08-22 12:25:25 +08:00
西风逍遥游 c47e061181 test(thread): cover Channel::demand and Thread::postMain
Fill the last thread-module API gaps: blocking demand() and cross-thread
postMain() into the Event queue (same-thread, empty-name throw, worker
thread). 46/46 thread bundle cases pass locally on win32-debug. Update
docs/dev/测试覆盖.md: thread row to '已展开' with a full API detail table.
2026-08-22 12:22:31 +08:00
西风逍遥游 4a0bb51bdc 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).
2026-08-20 14:23:45 +08:00
西风逍遥游 0b06713d13 Harden thread pool task lifetime and event wakeups 2026-08-14 22:40:52 +08:00
sunxfancyandCursor 87145e5ce2 feat: enhance system and thread modules with new functionalities and documentation updates
- Added the system module to provide OS, CPU, RAM, wall clock, sleep, clipboard, battery, and GPU information.
- Enhanced the thread module to support thread pools, tasks, and named channels for inter-thread communication.
- Updated documentation to reflect the new features in the system and thread modules, including usage examples and API references.
- Modified CMakeLists.txt to include the new system and thread modules, ensuring proper build configurations.
- Updated load.nut script to initialize the new system and thread functionalities.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 00:06:25 +08:00