aboutsummaryrefslogtreecommitdiffstats
path: root/api/direct_bt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-06-24 23:08:05 +0200
committerSven Gothel <[email protected]>2020-06-24 23:08:05 +0200
commit5af421c0d2b739f840958b983c26e61a35f991cf (patch)
treeff71a919d92a3df0c7b6afab6cad977385bf3081 /api/direct_bt
parent6c02b9355224f7af24c7547d00d7d546cd60f87b (diff)
DBTDevice: *connect* + disconnect: Lock via mutex *absent of proper atomic* and have hciConnHandle atomic for threading integrity.
Diffstat (limited to 'api/direct_bt')
-rw-r--r--api/direct_bt/DBTDevice.hpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/api/direct_bt/DBTDevice.hpp b/api/direct_bt/DBTDevice.hpp
index fdbdc3db..6c8097d1 100644
--- a/api/direct_bt/DBTDevice.hpp
+++ b/api/direct_bt/DBTDevice.hpp
@@ -62,11 +62,12 @@ namespace direct_bt {
int8_t rssi = 127; // The core spec defines 127 as the "not available" value
int8_t tx_power = 127; // The core spec defines 127 as the "not available" value
AppearanceCat appearance = AppearanceCat::UNKNOWN;
- uint16_t hciConnHandle = 0;
+ std::atomic<uint16_t> hciConnHandle;
std::shared_ptr<ManufactureSpecificData> msd = nullptr;
std::vector<std::shared_ptr<uuid_t>> services;
std::shared_ptr<GATTHandler> gattHandler = nullptr;
std::shared_ptr<GenericAccess> gattGenericAccess = nullptr;
+ std::recursive_mutex mtx_connect;
std::recursive_mutex mtx_data;
std::recursive_mutex mtx_gatt;
std::atomic<bool> isConnected;