We used to set the `errorRaised` variable from the `AsynchronousHolder`
thread then check its value from the main thread, which is correctly
reported as TSAN as a data race. We do know that we have waited enough,
and that otherwise it's fine to fail, but TSAN cannot know that. Switching
to a `std::atomic<bool>` fixes it.
errorRaised = true;
}
- bool errorRaised{false};
+ std::atomic<bool> errorRaised{false};
};
struct DummyCrossProtocolQuery : public CrossProtocolQuery
}
BOOST_CHECK(holder->empty());
- BOOST_CHECK(sender->errorRaised);
+ BOOST_CHECK(sender->errorRaised.load());
holder->stop();
}
}
BOOST_CHECK(holder->empty());
- BOOST_CHECK(sender->errorRaised);
+ BOOST_CHECK(sender->errorRaised.load());
holder->stop();
}