final class · System.Threading
AtomicBool
public final class AtomicBool
A bool that threads change together.
- Tipo
- final class
- Espacio de nombres
- System.Threading
- Ensamblado
- System.Core
- Acceso
- public, final
- Archivo fuente
Threading.ant
Herencia
- Clases base
-
AnyAtomicBool
Constructores
Propiedades
Métodos
Sets v if the value is comparand: the value before.
Miembros heredados (5)
GetTypemétodo de AnyUndescribedmétodo de AnyToStringmétodo de AnyHashmétodo de Anydestroymétodo de Any
Código fuente
AtomicBool en Antril, descompilado a partir de su Larva HIR.
// 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);
}
}
}
}