Skip to content

[API Proposal]: Interlocked.Increment does not have an overload for nint nor nuint #115237

Closed
@arontsang

Description

@arontsang

Background and motivation

Umm...probably pretty obvious.

Sure, var foo = location++ is probably atomic... But this is clearer.

API Proposal

namespace System.Threading;

public class Interlocked 
{
    public nuint Increment(ref nuint location);
    public nint Increment(ref nint location);
}

API Usage

// Fancy the value

nuint foo = 0;

var bar = Interlocked.Increment(ref foo);

Alternative Designs

No response

Risks

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions