Commit Graph
17 Commits
Author SHA1 Message Date
Antonio S. MusumeciandClaude Opus 4.7 e726610c6b thread_pool: add enqueue_task PToken overload + fill coverage gaps
Implementation:
- Add enqueue_task(PToken&, FuncType&&) overload so high-rate callers
  can use a dedicated producer token without losing the future-based
  return.  Mirrors the no-token version: try-enqueue with fast-path
  grow on pressure (autoscale pools), block-enqueue otherwise.

Tests (5 new, 87 total):
- tp_enqueue_task_with_ptoken: basic int/string/void futures via ptok
- tp_enqueue_task_ptoken_exception: exception forwarded through future
- tp_enqueue_task_ptoken_multiple_futures: 50 concurrent futures, all
  resolved correctly
- tp_construct_scaling_nonpositive_decline_throws: decline_threshold ≤ 0
  was the only ScalingConfig validation not covered by an explicit test
- tp_autoscale_fast_path_grow_on_pressure: verifies _maybe_grow_on_pressure
  fires (thread_count grows synchronously) when enqueue_work_autoscale
  finds the queue full

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 19:57:26 -04:00
Antonio S. MusumeciandClaude Opus 4.7 62b42c1c75 tests: add 12 new ThreadPool tests covering gaps
- tp_enqueue_task_broken_promise_on_destruction: verifies documented
  contract that unfulfilled promises throw broken_promise
- tp_thread_count_matches_threads_size: thread_count() == threads().size()
  after each synchronous mutation
- tp_thread_count_settles_after_churn: atomic mirror converges to
  threads().size() at rest after add/remove bursts
- tp_try_enqueue_work_for_ptoken_times_out_when_full: ptoken overload
  of try_enqueue_work_for was untested for the full-queue timeout path
- tp_tasks_pending_zero_at_construction: sanity check at init
- tp_tasks_pending_zero_after_all_complete: pending drains to 0
- tp_autoscale_verifiable_growth: deterministically asserts thread_count
  exceeds min after sustained queue pressure
- tp_autoscale_verifiable_shrink_to_min: threads shed to min_threads
  after idle_threshold_usecs
- tp_shutdown_ecanceled: smoke test that racing add/remove/set_threads
  against the destructor does not crash or deadlock
- tp_queue_depth_zero_at_idle: queue_depth() == 0 when no work pending
- tp_queue_capacity_unchanged_after_resize: set_threads does not alter
  the queue's max depth
- tp_tasks_enqueued_increments_before_completion: tasks_enqueued() leads
  tasks_completed() under a blocked worker

All 82 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 19:38:27 -04:00
Antonio S. Musumeci b8b97ffeca checkpoint 2026-04-11 17:17:26 -04:00
Antonio S. MusumeciandCopilot 13f56e6ea1 thread_pool: store scaling config by value
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-10 16:23:08 -04:00
Antonio SJ Musumeci 0f1a8e9b69 Fix error condition in fs_copyfile 2026-03-24 21:13:34 -04:00
Antonio SJ Musumeci 7f52623536 Cleanup branches and add more unit tests 2026-03-24 21:13:34 -04:00
Antonio SJ Musumeci a30a4df9c0 Cleanup config and add tests 2026-03-24 21:13:34 -04:00
Antonio SJ Musumeci 076e359891 Improve thread pool 2026-03-24 21:13:34 -04:00
Antonio SJ Musumeci 164b7f73c9 Misc fixes and improvements to thread pool 2026-03-24 21:13:34 -04:00
Antonio SJ Musumeci 3a45be4cd8 Rework string utils, more test cases 2026-03-24 21:13:34 -04:00
Antonio SJ Musumeci 8f1ef59770 Move 3rd party libraries to "vendored" directory 2026-03-02 01:09:16 -05:00
Antonio SJ Musumeci 160d3c832d Fix branches unit test 2026-03-02 01:09:16 -05:00
trapexit cfaad60275 Misc updates to arg parsing (#1554)
Ignore "defaults" and add a number of more modern VFS mount switches
2025-10-26 21:05:05 -05:00
trapexit d7549f8d53 Fix string manipulation functions after refactor (#1514) 2025-08-22 19:42:31 -05:00
Ilya Taranov d04e04e89a Fix config file parsing 2023-03-10 20:55:20 -08:00
Antonio SJ Musumeci d337574665 fix parsing of relative branch paths 2021-02-11 19:22:17 -05:00
Antonio SJ Musumeci 538467b86d config: rework global config, remove rwlock, make branches RCU like
Also added unit tests. Should have done separately but found a number of bugs.
2021-01-14 21:02:10 -05:00