From 9cac6a6461d3da607f6495bbec46fe8537340e3b Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Wed, 21 Feb 2024 10:46:34 +0100 Subject: [PATCH] Added comment for std::atomic::exchange() --- src/runProc.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/runProc.cpp b/src/runProc.cpp index d7af5e8..a7783d8 100644 --- a/src/runProc.cpp +++ b/src/runProc.cpp @@ -49,6 +49,9 @@ void T_runProc::runProc_slotProcess(void) { #ifndef THIS_IS_CA_MASTER bool const coinAttached = epi_getDI_CoinAttach(); + // exchange: (atomically) replaces the underlying value of m_coinAttached + // with the value of coinAttached, returns the value of m_coinAttached + // before the call if (m_coinAttached.exchange(coinAttached) == false) { if (coinAttached) { // old value was false, and new value is true