Skip to content

Potential zero threads #51

@TLCFEM

Description

@TLCFEM

explicit thread_pool(const concurrency_t thread_count_ = std::thread::hardware_concurrency()) : thread_count(thread_count_ ? thread_count_ : std::thread::hardware_concurrency()), threads(std::make_unique<std::thread[]>(thread_count_ ? thread_count_ : std::thread::hardware_concurrency()))

std::thread::hardware_concurrency() may return 0. So when constructed as thread_pool(), thread_count may be initialised to 0. thread_count(thread_count_ > 1 ? thread_count_ : 1 may be safer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions