Skip to content

[Feature] Using new Lock api when target Net 9+ #4

@NotAsea

Description

@NotAsea

Reason

Net 9 + introduce Lock type that more efficient than plain object type. Consider using Lock since we already target Net 9 and Net 10.

Reference lock statement

Implementation

In Line 18 we have

    private static readonly object _lock = new();

We can introduce #if directive to using new Lock type, like this

    #if NET9_0_OR_GREATER
     private static readonly Lock _lock = new();
    #else
     private static readonly object _lock = new();
    #endif

the rest can stay as is as compiler will recognize this type and automatically lower correctly for us

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions