Package eu.mihosoft.devcom
Class AtomicFlag
java.lang.Object
eu.mihosoft.devcom.AtomicFlag
Flag wrap for atomically flipping a boolean value.
-
Constructor Summary
ConstructorDescriptionCreates a new atomic flag.AtomicFlag
(boolean initialValue) Creates a new atomic flag.AtomicFlag
(AtomicBoolean atomicBoolean) Creates a new atomic flag. -
Method Summary
-
Constructor Details
-
AtomicFlag
public AtomicFlag()Creates a new atomic flag. -
AtomicFlag
public AtomicFlag(boolean initialValue) Creates a new atomic flag.- Parameters:
initialValue
- the initial value of the boolean
-
AtomicFlag
Creates a new atomic flag.- Parameters:
atomicBoolean
- the atomic boolean to wrap
-
-
Method Details
-
negate
public boolean negate()Flip the wrapped AtomicBoolean. It sets the boolean value to false if it is true, and to true if it is false with memory effects as specified byVarHandle.setVolatile(java.lang.Object...)
.- Returns:
- new boolean value of AtomicBoolean
- See Also:
-