Skip to content

Conversation

@DormancyWang
Copy link
Contributor

Since threads count is already guaranteed to be less or equal than max_active_threads in thread_pool.rb:line 113, there is no need to double check.

Not to mention that this will cause a race condition on the JRuby platform, as noted in 5ac9df0.

Removing the conditional check will also reduce lock acquisitions and improve overall efficiency.

In the original commit 1737459, this check was essential. However, after subsequent changes, it seems no one performed a careful review of this logic.

Since threads count is already guaranteed to be less or equal than
max_active_threads in thread_pool.rb:line 113, there is no need to
double check.

Not to mention that this will cause a race condition on the JRuby
platform, as noted in 5ac9df0.

Removing the conditional check will also reduce lock acquisitions
and improve overall efficiency.

In the original commit 1737459,
this check was essential. However, after subsequent changes,
it seems no one performed a careful review of this logic.
@hsbt
Copy link
Member

hsbt commented Jun 6, 2025

👍

@hsbt hsbt merged commit 15aa9ab into ruby:master Jun 6, 2025
30 checks passed
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