Description
ThreadPool(name, 0, positiveMax) is a valid lazy-start configuration, but run() only adds a worker when the task queue is already nonempty. Its first task is queued with no worker and never runs. A zero maximum likewise accepts tasks that can never execute, while an initial count above the maximum violates the configured cap.
Reproduction
Construct ThreadPool("test", 0, 1), queue one task, and destroy/join the pool. The task never runs on current main.
Expected behavior
A zero-initial-worker pool with positive capacity should start its first worker lazily; impossible worker-limit configurations should reject during construction.
Description
ThreadPool(name, 0, positiveMax)is a valid lazy-start configuration, butrun()only adds a worker when the task queue is already nonempty. Its first task is queued with no worker and never runs. A zero maximum likewise accepts tasks that can never execute, while an initial count above the maximum violates the configured cap.Reproduction
Construct
ThreadPool("test", 0, 1), queue one task, and destroy/join the pool. The task never runs on current main.Expected behavior
A zero-initial-worker pool with positive capacity should start its first worker lazily; impossible worker-limit configurations should reject during construction.