Skip to content

Zero-worker ThreadPool never starts queued work #1551

Description

@OskarEichler

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions