final class · System.Threading

AtomicBool

public final class AtomicBool

A bool that threads change together.

Kind
final class
Namespace
System.Threading
Assembly
System.Core
Access
public, final
Source file
Threading.ant

Inheritance

Base classes
Any AtomicBool

Constructors

new()
#
new(bool value)
#

Properties

bool Value { get; set; }
#

Methods

Load() : bool
#
Store(bool v)
#
Exchange(bool v) : bool
#
CompareExchange(bool v, bool comparand) : bool
#

Sets v if the value is comparand: the value before.

Private and internal members (1)

AtomicI32 bits
#

private

Inherited members (5)

Source

AtomicBool as Antril, decompiled from its Larva HIR.

System.Threading.AtomicBool.ant
// System.Threading.AtomicBool — System.Core (decompiled from Larva HIR)

into namespace System.Threading
{
	/// A bool that threads change together.
	public final class AtomicBool
	{
		AtomicI32 bits;

		public:
			new()
			{
				bits = new AtomicI32();
			}

			new(bool value)
			{
				bits = new AtomicI32(value ? 1 : 0);
			}

			Load() : bool => bits.Load() != 0;

			Store(bool v)
			{
				bits.Store(v ? 1 : 0);
			}

			Exchange(bool v) : bool => bits.Exchange(v ? 1 : 0) != 0;

			/// Sets `v` if the value is `comparand`: the value before.
			CompareExchange(bool v, bool comparand) : bool => bits.CompareExchange(v ? 1 : 0, comparand ? 1 : 0) != 0;

			bool Value
			{
				get => Load();
				set
				{
					Store(value);
				}
			}
	}
}
Esc