Skip to content

avoid potential RC on ctx->threadLimit (gh-4547), code review#4601

Merged
terrelln merged 1 commit intofacebook:devfrom
sebres:gh-4547--pool-thlimit-rc-review
Mar 2, 2026
Merged

avoid potential RC on ctx->threadLimit (gh-4547), code review#4601
terrelln merged 1 commit intofacebook:devfrom
sebres:gh-4547--pool-thlimit-rc-review

Conversation

@sebres
Copy link
Contributor

@sebres sebres commented Mar 1, 2026

As already said in #4547, there is no RC currently, but for consistence reasons and to avoid potential RC in the future by possible changes...
Possible alternative could be to lock the fresh created mutex before first worker thread gets created (and unlock it before return).
Closes #4547, replaces #4558

return 0;
}
/* numThreads > threadCapacity */
ctx->threadLimit = numThreads;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a minor change in behavior when an operation fails below, but it seems fine & slightly preferable.

@terrelln terrelln merged commit 6e1e545 into facebook:dev Mar 2, 2026
105 checks passed
@sebres sebres deleted the gh-4547--pool-thlimit-rc-review branch March 3, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data race on ctx->threadLimit between POOL_thread() and POOL_create_advanced()

2 participants