Soenneker.Atomics.Bools 11.0.84

Prefix Reserved
dotnet add package Soenneker.Atomics.Bools --version 11.0.84
                    
NuGet\Install-Package Soenneker.Atomics.Bools -Version 11.0.84
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Atomics.Bools" Version="11.0.84" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Atomics.Bools" Version="11.0.84" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Atomics.Bools" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Atomics.Bools --version 11.0.84
                    
#r "nuget: Soenneker.Atomics.Bools, 11.0.84"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.Atomics.Bools@11.0.84
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Atomics.Bools&version=11.0.84
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Atomics.Bools&version=11.0.84
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Atomics.Bools

A lightweight atomic boolean wrapper implemented on top of ValueAtomicBool. This is a reference type so it can be safely shared without accidental struct copying.

Install

dotnet add package Soenneker.Atomics.Bools

Usage

Use TrySetTrue when exactly one concurrent caller should win a transition:

using Soenneker.Atomics.Bools;

private readonly AtomicBool _started = new();

public void Start()
{
    if (!_started.TrySetTrue())
        return;

    // Only the false-to-true winner reaches this point.
    StartCore();
}

Exchange is useful when the previous state determines the action:

bool wasEnabled = featureEnabled.Exchange(false);

AtomicBool is a reference type, so every holder of the same instance observes the same atomic state. Its individual operations are atomic; a sequence such as if (!Value) Value = true is not. Use TrySetTrue, TrySetFalse, or CompareAndSet for conditional transitions.

What you get

  • AtomicBool — A lightweight atomic boolean wrapper implemented on top of ValueAtomicBool. This is a reference type so it can be safely shared without accidental struct copying.

API at a glance

API What it does Result / important behavior
AtomicBool.Read() Reads the current value of the atomic boolean. true if reads the current value of the atomic boolean; otherwise, false.
AtomicBool.Write(value) Writes a new value to the atomic boolean. Returns no value; the requested change is complete when the method returns.
AtomicBool.Exchange(value) Atomically replaces the current value with value and returns the previous value. true if atomically replaces the current value with and returns the previous value; otherwise, false.
AtomicBool.CompareAndSet(expected, newValue) Atomically sets the value to newValue if the current value equals expected. true if atomically sets the value to if the current value equals; otherwise, false.
AtomicBool.Value Gets or sets the current value of the atomic boolean. Gets or sets the current value of the atomic boolean.
AtomicBool.TrySetTrue() Attempts to atomically transition the value from false to true. true if the requested update was applied; otherwise, false.
AtomicBool.TrySetFalse() Attempts to atomically transition the value from true to false. true if the requested update was applied; otherwise, false.
AtomicBool.ToString() Returns a string representation of the current instance. The result of the operation.
Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.84 74 11/18/2026
11.0.82 93 11/11/2026
11.0.81 90 11/11/2026
11.0.80 143 10/27/2026
11.0.78 102 10/26/2026
11.0.77 100 10/26/2026
4.0.76 112 10/15/2026
4.0.75 111 10/14/2026
4.0.74 104 10/14/2026
4.0.73 103 10/14/2026
4.0.72 108 10/14/2026
4.0.66 100 10/12/2026
4.0.64 99 10/12/2026
4.0.63 100 10/11/2026
4.0.62 106 10/11/2026
4.0.61 165 9/24/2026
4.0.60 114 9/24/2026
4.0.59 120 9/16/2026
4.0.58 118 9/15/2026
4.0.57 110 9/15/2026
Loading failed

Updated Soenneker.Atomics.ValueBools to 11.0.57