aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-05-28 19:10:28 +0200
committerSven Gothel <[email protected]>2020-05-28 19:10:28 +0200
commit93c70956beddc007ba615b850401eb16cc9683dd (patch)
tree9fee37629c9130d42037870db767b9eae3a19b4f /src
parentfafc8db2ed2f2975148665e7224412b72ac03df2 (diff)
Use atomic as a memory barrier (data race), volatile is not suitable for multithreading.
Diffstat (limited to 'src')
-rw-r--r--src/direct_bt/DBTAdapter.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/direct_bt/DBTAdapter.cpp b/src/direct_bt/DBTAdapter.cpp
index 948d02eb..ca8db464 100644
--- a/src/direct_bt/DBTAdapter.cpp
+++ b/src/direct_bt/DBTAdapter.cpp
@@ -104,6 +104,8 @@ std::shared_ptr<DBTDevice> DBTAdapter::findConnectedDevice (EUI48 const & mac) c
// *************************************************
bool DBTAdapter::validateDevInfo() {
+ keepDiscoveringAlive = false;
+
if( !mgmt.isOpen() || 0 > dev_id ) {
return false;
}
@@ -435,7 +437,7 @@ std::string DBTAdapter::toString() const {
bool DBTAdapter::mgmtEvDeviceDiscoveringCB(std::shared_ptr<MgmtEvent> e) {
DBG_PRINT("DBTAdapter::EventCB:DeviceDiscovering(dev_id %d, keepDiscoveringAlive %d): %s",
- dev_id, keepDiscoveringAlive, e->toString().c_str());
+ dev_id, keepDiscoveringAlive.load(), e->toString().c_str());
const MgmtEvtDiscovering &event = *static_cast<const MgmtEvtDiscovering *>(e.get());
const bool enabled = event.getEnabled();
for_each_idx_mtx(mtx_statusListenerList, statusListenerList, [&](std::shared_ptr<AdapterStatusListener> &l) {