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>
- 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>