Skip to content

Remove unnecessary layers of indirection in PreallocatedOverlapped.#131182

Merged
JulieLeeMSFT merged 1 commit into
dotnet:mainfrom
teo-tsirpanis:cleanup-preallocatedoverlapped
Jul 22, 2026
Merged

Remove unnecessary layers of indirection in PreallocatedOverlapped.#131182
JulieLeeMSFT merged 1 commit into
dotnet:mainfrom
teo-tsirpanis:cleanup-preallocatedoverlapped

Conversation

@teo-tsirpanis

Copy link
Copy Markdown
Contributor

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.

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.
Copilot AI review requested due to automatic review settings July 22, 2026 05:24
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jul 22, 2026
@azure-pipelines

Copy link
Copy Markdown
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.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @VSadov
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 UnsafeCreate to directly invoke the private ctor (removing platform-routing wrappers that were equivalent).
  • Collapsed AddRef, Release, and Dispose routing logic into direct _lifetime calls.
  • 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.

@JulieLeeMSFT

Copy link
Copy Markdown
Member

/ba-g known issue.

@JulieLeeMSFT
JulieLeeMSFT merged commit b02815c into dotnet:main Jul 22, 2026
149 of 151 checks passed
@teo-tsirpanis
teo-tsirpanis deleted the cleanup-preallocatedoverlapped branch July 22, 2026 19:06
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Threading community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants