Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Proposal: Add generic UnsafeQueueUserWorkItem<TState> overload #27507

Closed
davidfowl opened this issue Sep 29, 2018 · 4 comments
Closed

API Proposal: Add generic UnsafeQueueUserWorkItem<TState> overload #27507

davidfowl opened this issue Sep 29, 2018 · 4 comments
Assignees
Labels
api-approved API was approved in API review, it can be implemented area-System.Threading
Milestone

Comments

@davidfowl
Copy link
Member

In .NET Core 2.1 we added a generic overload of QueueUserWorkItem that can avoid boxing the state parameter https://github.com/dotnet/corefx/issues/27464#issue-300109510. We should add the same overload for UnsafeQueueUserWorkItem. I'd like to use this in pipelines to offer a PipeScheduler that avoids capturing the ExecutionContext.

public static bool UnsafeQueueUserWorkItem<TState>(Action<TState> callBack, TState state, bool preferLocal)

cc @stephentoub

@benaadams
Copy link
Member

Could this be 3.0?

@davidfowl
Copy link
Member Author

It must 😬. There’s at least one other thing that want me to use this in 3.0

@benaadams
Copy link
Member

Add the 3.0 milestone? They get preference in api reviews

@terrajobst
Copy link
Member

Given that we already approved the Unsafe* pattern here and that we did this overload for the non-unsafe ones, there is no reason not to approve this :-)

@stephentoub stephentoub self-assigned this Nov 20, 2018
@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 3.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-approved API was approved in API review, it can be implemented area-System.Threading
Projects
None yet
Development

No branches or pull requests

5 participants