diff options
author | Sven Gothel <[email protected]> | 2020-06-10 02:07:45 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-06-10 02:07:45 +0200 |
commit | 2327544fb67d39ea2badbf2c162a9d5dcd526cb6 (patch) | |
tree | cf0dc452546422ab96b1ec9c580fd52440fb6f30 /api | |
parent | 345aa52cfbf20db53fd76c3b36e1432a9da1c937 (diff) |
Threading robustness: DBTManager, GATTHandler, HCIHandler: Reader thread startup: Ensure mgmtReaderThread is running
Diffstat (limited to 'api')
-rw-r--r-- | api/direct_bt/DBTManager.hpp | 2 | ||||
-rw-r--r-- | api/direct_bt/GATTHandler.hpp | 2 | ||||
-rw-r--r-- | api/direct_bt/HCIHandler.hpp | 2 |
3 files changed, 6 insertions, 0 deletions
diff --git a/api/direct_bt/DBTManager.hpp b/api/direct_bt/DBTManager.hpp index f62b7626..190a9a3a 100644 --- a/api/direct_bt/DBTManager.hpp +++ b/api/direct_bt/DBTManager.hpp @@ -83,6 +83,8 @@ namespace direct_bt { std::thread mgmtReaderThread; std::atomic<bool> mgmtReaderRunning; std::atomic<bool> mgmtReaderShallStop; + std::mutex mtx_mgmtReaderInit; + std::condition_variable cv_mgmtReaderInit; /** One MgmtAdapterEventCallbackList per event type, allowing multiple callbacks to be invoked for each event */ std::array<MgmtAdapterEventCallbackList, static_cast<uint16_t>(MgmtEvent::Opcode::MGMT_EVENT_TYPE_COUNT)> mgmtAdapterEventCallbackLists; diff --git a/api/direct_bt/GATTHandler.hpp b/api/direct_bt/GATTHandler.hpp index 45fae8ed..aad728c0 100644 --- a/api/direct_bt/GATTHandler.hpp +++ b/api/direct_bt/GATTHandler.hpp @@ -94,6 +94,8 @@ namespace direct_bt { std::atomic<pthread_t> l2capReaderThreadId; std::atomic<bool> l2capReaderRunning; std::atomic<bool> l2capReaderShallStop; + std::mutex mtx_l2capReaderInit; + std::condition_variable cv_l2capReaderInit; /** send immediate confirmation of indication events from device, defaults to true. */ bool sendIndicationConfirmation = true; diff --git a/api/direct_bt/HCIHandler.hpp b/api/direct_bt/HCIHandler.hpp index 95ab81f7..21db6425 100644 --- a/api/direct_bt/HCIHandler.hpp +++ b/api/direct_bt/HCIHandler.hpp @@ -97,6 +97,8 @@ namespace direct_bt { std::atomic<pthread_t> hciReaderThreadId; std::atomic<bool> hciReaderRunning; std::atomic<bool> hciReaderShallStop; + std::mutex mtx_hciReaderInit; + std::condition_variable cv_hciReaderInit; void hciReaderThreadImpl(); |