mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-25 10:01:33 +08:00
Fix atomic level
This commit is contained in:
parent
7d9cf59649
commit
5683d16b36
@ -22,21 +22,23 @@ struct null_atomic
|
|||||||
{
|
{
|
||||||
T value;
|
T value;
|
||||||
|
|
||||||
explicit null_atomic(T new_value)
|
null_atomic() = default;
|
||||||
|
|
||||||
|
explicit constexpr null_atomic(T new_value)
|
||||||
: value(new_value)
|
: value(new_value)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
[[nodiscard]] T load(std::memory_order = std::memory_order_relaxed) const noexcept
|
[[nodiscard]] T load(std::memory_order = std::memory_order_seq_cst) const
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void store(T new_value, std::memory_order = std::memory_order_relaxed) noexcept
|
void store(T new_value, std::memory_order = std::memory_order_seq_cst)
|
||||||
{
|
{
|
||||||
value = new_value;
|
value = new_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
T exchange(T new_value, std::memory_order = std::memory_order_relaxed) noexcept
|
T exchange(T new_value, std::memory_order = std::memory_order_seq_cst)
|
||||||
{
|
{
|
||||||
std::swap(new_value, value);
|
std::swap(new_value, value);
|
||||||
return new_value; // return value before the call
|
return new_value; // return value before the call
|
||||||
|
Loading…
Reference in New Issue
Block a user