14#include "arcane/utils/Atomic.h"
16#ifdef ARCANE_HAS_CXX20
32 void _setValue(
volatile Int32* ptr, Int32 value)
34#ifdef ARCANE_HAS_CXX20
35 std::atomic_ref<Int32> r(*
const_cast<Int32*
>(ptr));
38 g_atomic_int_set(ptr, value);
41 Int32 _getValue(
volatile Int32* ptr)
43#ifdef ARCANE_HAS_CXX20
44 std::atomic_ref<Int32> r(*
const_cast<Int32*
>(ptr));
47 return g_atomic_int_get(ptr);
50 Int32 _atomicAdd(
volatile Int32* ptr)
52#ifdef ARCANE_HAS_CXX20
53 std::atomic_ref<Int32> r(*
const_cast<Int32*
>(ptr));
54 return r.fetch_add(1) + 1;
56 return g_atomic_int_add(ptr, 1) + 1;
59 Int32 _atomicSub(
volatile Int32* ptr)
61#ifdef ARCANE_HAS_CXX20
62 std::atomic_ref<Int32> r(*
const_cast<Int32*
>(ptr));
63 return r.fetch_sub(1) - 1;
65 return g_atomic_int_add(ptr, -1) - 1;
91 _setValue(&m_value, v);
97 return _atomicAdd(&m_value);
103 return _atomicSub(&m_value);
109 _setValue(&m_value, v);
118 return _getValue(&m_value);
122increment(
volatile Int32* v)
124 return _atomicAdd(v);
128decrement(
volatile Int32* v)
130 return _atomicSub(v);
134setValue(
volatile Int32* v, Int32 new_v)
140getValue(
volatile Int32* v)
AtomicInt32()
Constructeur: attention, aucune initialisation.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-