BAN: Add compare_exchange to atomic

This commit is contained in:
Bananymous 2024-01-30 01:06:32 +02:00
parent a1faa836c5
commit cc79f55817
1 changed files with 2 additions and 0 deletions

View File

@ -35,6 +35,8 @@ namespace BAN
inline T operator--(int) volatile { return __atomic_fetch_sub(&m_value, 1, MEM_ORDER); }
inline T operator++(int) volatile { return __atomic_fetch_add(&m_value, 1, MEM_ORDER); }
inline bool compare_exchange(T expected, T desired) volatile { return __atomic_compare_exchange_n(&m_value, &expected, desired, false, MEM_ORDER, MEM_ORDER); }
private:
T m_value;
};