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

like #24694,Interlocked.CompareExchange/Exchange still missing for UIntPtr #45103

Closed
bysdxt opened this issue Nov 23, 2020 · 4 comments · Fixed by #68966
Closed

like #24694,Interlocked.CompareExchange/Exchange still missing for UIntPtr #45103

bysdxt opened this issue Nov 23, 2020 · 4 comments · Fixed by #68966
Assignees
Labels
api-approved API was approved in API review, it can be implemented area-System.Threading
Milestone

Comments

@bysdxt
Copy link

bysdxt commented Nov 23, 2020

Background and Motivation

.net5 adds support for native int(nint and nuint), System.Threading.Interlocked should support them too

Proposed API

namespace System.Threading
{
     public static class Interlocked {
+        public static extern UIntPtr CompareExchange(ref UIntPtr location1, UIntPtr value, UIntPtr comparand);
+        public static extern UIntPtr Exchange(ref UIntPtr location1, UIntPtr value);
     }
@bysdxt bysdxt added the api-suggestion Early API idea and discussion, it is NOT ready for implementation label Nov 23, 2020
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.Threading untriaged New issue has not been triaged by the area owner labels Nov 23, 2020
@GSPP
Copy link

GSPP commented Dec 10, 2020

This is the set of .NET 5.0 Interlocked methods:

image

Maybe we should add IntPtr and UIntPtr overloads to Add, Increment, Decrement, And and Or.

Is Interlocked.Read still relevant or does Volatile cover that? If still relevant, adding *Ptr overloads there would make sense, too.

@mangod9 mangod9 removed the untriaged New issue has not been triaged by the area owner label Jul 4, 2021
@mangod9 mangod9 added this to the Future milestone Jul 4, 2021
@hamarb123
Copy link
Contributor

This should be higher priority now that there is the nuint keyword.

@timcassell
Copy link

+1

I was just looking for Interlocked.Add with nint overload, saddened to see it doesn't exist.

@stephentoub stephentoub added api-ready-for-review API is ready for review, it is NOT ready for implementation and removed api-suggestion Early API idea and discussion, it is NOT ready for implementation labels Mar 22, 2022
@terrajobst
Copy link
Member

  • Looks good as proposed
namespace System.Threading
{
    public static class Interlocked
    {
        public static extern UIntPtr CompareExchange(ref UIntPtr location1, UIntPtr value, UIntPtr comparand);
        public static extern UIntPtr Exchange(ref UIntPtr location1, UIntPtr value);
    }
}

@terrajobst terrajobst added api-approved API was approved in API review, it can be implemented and removed api-ready-for-review API is ready for review, it is NOT ready for implementation labels Apr 14, 2022
@stephentoub stephentoub self-assigned this May 6, 2022
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label May 6, 2022
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label May 7, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jun 6, 2022
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

Successfully merging a pull request may close this issue.

8 participants