Added comment for std::atomic<bool>::exchange()

This commit is contained in:
Gerhard Hoffmann 2024-02-21 10:46:34 +01:00
parent aa10d3b275
commit 9cac6a6461

View File

@ -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