Skip to content

Validate thread count in thpool_init() and return NULL for non-positi…#136

Open
Lee-shihao wants to merge 1 commit into
Pithikos:masterfrom
Lee-shihao:master
Open

Validate thread count in thpool_init() and return NULL for non-positi…#136
Lee-shihao wants to merge 1 commit into
Pithikos:masterfrom
Lee-shihao:master

Conversation

@Lee-shihao
Copy link
Copy Markdown

This pull request adds a sanity check to thpool_init() to ensure that the number of threads passed during initialization is greater than zero. If a non-positive value (≤ 0) is provided, the function now logs an error and returns NULL.

Previously, passing num_threads <= 0 would silently proceed, potentially resulting in a thread pool with zero threads—causing jobs to never be executed and thpool_wait() to hang indefinitely.

@Lee-shihao Lee-shihao closed this Jul 2, 2025
@Lee-shihao Lee-shihao reopened this Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants