MySQL 9.0.0
Source Code Documentation
atomic_boolean Class Reference

Utility class implementing an atomic boolean on top of an int32. More...

Public Member Functions

 atomic_boolean (bool value=false)
 Constructs a new atomic_boolean. More...
 
bool is_set (bool value=true)
 Checks if the atomic boolean has a certain value. More...
 
void set (bool new_value)
 Sets a new value for the atomic boolean. More...
 

Private Attributes

std::atomic< int32m_value
 storage for the boolean's current value More...
 

Static Private Attributes

static const int m_true = 0
 constants for true and false More...
 
static const int m_false = 1
 

Detailed Description

Utility class implementing an atomic boolean on top of an int32.

The mysys lib does not support atomic booleans.

Constructor & Destructor Documentation

◆ atomic_boolean()

atomic_boolean::atomic_boolean ( bool  value = false)
inline

Constructs a new atomic_boolean.

Parameters
valueThe value to initialize the boolean with.

Member Function Documentation

◆ is_set()

bool atomic_boolean::is_set ( bool  value = true)
inline

Checks if the atomic boolean has a certain value.

if used without an argument checks if the atomic boolean is on.

Parameters
valuethe value to check for
Return values
truethe atomic boolean value matches the argument value
falsethe atomic boolean value is different from the argument value

◆ set()

void atomic_boolean::set ( bool  new_value)
inline

Sets a new value for the atomic boolean.

Parameters
new_valuevalue to set

Member Data Documentation

◆ m_false

const int atomic_boolean::m_false = 1
staticprivate

◆ m_true

const int atomic_boolean::m_true = 0
staticprivate

constants for true and false

◆ m_value

std::atomic<int32> atomic_boolean::m_value
private

storage for the boolean's current value


The documentation for this class was generated from the following file: