Skip to content

Conversation

@Leo-jiahao
Copy link

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.

@Leo-jiahao Leo-jiahao closed this Jul 2, 2025
@Leo-jiahao Leo-jiahao 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