From 30fdc2198ff42c55869f6f4259d7c9343c40d38c Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 20 Jun 2024 13:24:42 +0300 Subject: [PATCH] BAN: Add exchage() to Atomic --- BAN/include/BAN/Atomic.h | 1 + 1 file changed, 1 insertion(+) diff --git a/BAN/include/BAN/Atomic.h b/BAN/include/BAN/Atomic.h index 62a54e81c0..18b7ac87f5 100644 --- a/BAN/include/BAN/Atomic.h +++ b/BAN/include/BAN/Atomic.h @@ -46,6 +46,7 @@ namespace BAN inline T operator++(int) volatile { return __atomic_fetch_add(&m_value, 1, MEM_ORDER); } inline bool compare_exchange(T expected, T desired, MemoryOrder mem_order = MEM_ORDER) volatile { return __atomic_compare_exchange_n(&m_value, &expected, desired, false, mem_order, mem_order); } + inline T exchange(T desired, MemoryOrder mem_order = MEM_ORDER) volatile { return __atomic_exchange_n(&m_value, desired, mem_order); }; private: T m_value;