A boolean value that may be updated atomically.
More...
#include <src/main/decaf/util/concurrent/atomic/AtomicBoolean.h>
Public Member Functions |
| | AtomicBoolean () |
| | Creates a new AtomicBoolean whose initial value is false.
|
| | AtomicBoolean (bool initialValue) |
| | Creates a new AtomicBoolean with the initial value.
|
| virtual | ~AtomicBoolean () |
| bool | get () const |
| | Gets the current value of this AtomicBoolean.
|
| void | set (bool newValue) |
| | Unconditionally sets to the given value.
|
| bool | compareAndSet (bool expect, bool update) |
| | Atomically sets the value to the given updated value if the current value == the expected value.
|
| bool | getAndSet (bool newValue) |
| | Atomically sets to the given value and returns the previous value.
|
| std::string | toString () const |
| | Returns the String representation of the current value.
|
Detailed Description
A boolean value that may be updated atomically.
An AtomicBoolean is used in applications such as atomically updated flags, and cannot be used as a replacement for a Boolean.
Constructor & Destructor Documentation
| decaf::util::concurrent::atomic::AtomicBoolean::AtomicBoolean |
( |
| ) |
|
| decaf::util::concurrent::atomic::AtomicBoolean::AtomicBoolean |
( |
bool |
initialValue | ) |
|
Creates a new AtomicBoolean with the initial value.
- Parameters
-
| initialValue | - The initial value of this boolean. |
| virtual decaf::util::concurrent::atomic::AtomicBoolean::~AtomicBoolean |
( |
| ) |
|
|
inlinevirtual |
Member Function Documentation
| bool decaf::util::concurrent::atomic::AtomicBoolean::compareAndSet |
( |
bool |
expect, |
|
|
bool |
update |
|
) |
| |
Atomically sets the value to the given updated value if the current value == the expected value.
- Parameters
-
| expect | - the expected value |
| update | - the new value |
- Returns
- true if successful. False return indicates that the actual value was not equal to the expected value.
| bool decaf::util::concurrent::atomic::AtomicBoolean::get |
( |
| ) |
const |
|
inline |
Gets the current value of this AtomicBoolean.
- Returns
- the currently set value.
| bool decaf::util::concurrent::atomic::AtomicBoolean::getAndSet |
( |
bool |
newValue | ) |
|
Atomically sets to the given value and returns the previous value.
- Parameters
-
- Returns
- the previous value
| void decaf::util::concurrent::atomic::AtomicBoolean::set |
( |
bool |
newValue | ) |
|
|
inline |
Unconditionally sets to the given value.
- Parameters
-
| std::string decaf::util::concurrent::atomic::AtomicBoolean::toString |
( |
| ) |
const |
Returns the String representation of the current value.
- Returns
- the String representation of the current value.
The documentation for this class was generated from the following file: