Races and memory faults in ThreadPool.ensureThreads #1

Closed
opened 2025-10-31 05:28:21 +00:00 by toastyyyxd · 1 comment
toastyyyxd commented 2025-10-31 05:28:21 +00:00 (Migrated from github.com)
  • the same thread index could be initialized by more than one concurrent callers.
  • thread_count is incremented before thread is known to be successfully spawned.
  • init only commits init_thread_count * stack_size of memory, initializing more threads on some OSes will cause faults.

other isses in TheadPool:

  • TheadError is useless.
  • .seq_cst is sometimes unneccesarily used instead of .acq_rel.
  • document and tune heuristics for automatic thread scaling.
- [x] the same thread index could be initialized by more than one concurrent callers. - [x] `thread_count` is incremented before thread is known to be successfully spawned. - [x] `init` only commits `init_thread_count * stack_size` of memory, initializing more threads on some OSes will cause faults. other isses in `TheadPool`: - [x] `TheadError` is useless. - [x] `.seq_cst` is sometimes unneccesarily used instead of `.acq_rel`. - [ ] document and tune heuristics for automatic thread scaling.
toastyyyxd commented 2025-11-13 00:02:35 +00:00 (Migrated from github.com)

will tune heuristics later™️

will tune heuristics later™️
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
toasty/stratagem#1
No description provided.