Remove unnecessary layers of indirection in PreallocatedOverlapped.#131182
Merged
JulieLeeMSFT merged 1 commit intoJul 22, 2026
Merged
Conversation
Several of the class' methods have three editions each; one for the portable thread pool, one for the Windows thread pool, and the external-facing entry point that routes to one of the above. However, for four of the families of methods, both thread pool editions are identical, and were folded into one method each.
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @VSadov |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR simplifies PreAllocatedOverlapped by removing redundant Windows-thread-pool vs portable-thread-pool wrapper methods where both implementations were identical, leaving a single shared code path for creation and lifetime operations.
Changes:
- Simplified
UnsafeCreateto directly invoke the private ctor (removing platform-routing wrappers that were equivalent). - Collapsed
AddRef,Release, andDisposerouting logic into direct_lifetimecalls. - Deleted now-unnecessary per-thread-pool wrapper methods from the WindowsThreadPool and Portable partials.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/libraries/System.Private.CoreLib/src/System/Threading/PreAllocatedOverlapped.WindowsThreadPool.cs | Removes redundant Windows thread pool wrapper methods; keeps only Windows-thread-pool-specific final-release logic. |
| src/libraries/System.Private.CoreLib/src/System/Threading/PreAllocatedOverlapped.Windows.cs | Unifies creation and lifetime management (UnsafeCreate / AddRef / Release / Dispose) to a single implementation. |
| src/libraries/System.Private.CoreLib/src/System/Threading/PreAllocatedOverlapped.Portable.cs | Removes redundant portable wrapper methods; keeps only portable-specific final-release logic. |
jkotas
approved these changes
Jul 22, 2026
Member
|
/ba-g known issue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Several of the class' methods have three editions each; one for the portable thread pool, one for the Windows thread pool, and the external-facing entry point that routes to one of the above. However, for four of the families of methods, both thread pool editions are identical, and were folded into one method each.