diff options
author | Sven Gothel <[email protected]> | 2020-10-07 13:18:45 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-10-07 13:18:45 +0200 |
commit | cebdb818fbc8115f6b5f3649dba75bf7bfacf828 (patch) | |
tree | a7b75eaf9b041d93ec06c713602b389d7ed32a31 /src/direct_bt | |
parent | 3816324555c36885f4ba8379a30a2f96066b6e6c (diff) |
helgrind 'lock order': DBTAdapter::remove(): Don't explicitly lock anything, avoiding different lock-order. (WIP)
Also just call device.disconnect() and rely on atomic lock-free allowDisconnect decision.
Diffstat (limited to 'src/direct_bt')
-rw-r--r-- | src/direct_bt/DBTAdapter.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/direct_bt/DBTAdapter.cpp b/src/direct_bt/DBTAdapter.cpp index cb7f536d..eb9ec4cb 100644 --- a/src/direct_bt/DBTAdapter.cpp +++ b/src/direct_bt/DBTAdapter.cpp @@ -660,12 +660,7 @@ std::shared_ptr<DBTDevice> DBTAdapter::findSharedDevice (EUI48 const & mac, cons } void DBTAdapter::removeDevice(DBTDevice & device) noexcept { - // Lock device.mtx_connect to avoid other threads connecting or disconnecting while removing - // and holding mtx_sharedDevices also blocks deviceFound etc .. - const std::scoped_lock lock_conn(device.mtx_connect, mtx_sharedDevices); // RAII-style acquire and relinquish via destructor - if( device.getConnected() ) { - device.disconnect(HCIStatusCode::REMOTE_USER_TERMINATED_CONNECTION); - } + device.disconnect(HCIStatusCode::REMOTE_USER_TERMINATED_CONNECTION); removeConnectedDevice(device); // usually done in DBTAdapter::mgmtEvDeviceDisconnectedHCI removeDiscoveredDevice(device); // usually done in DBTAdapter::mgmtEvDeviceDisconnectedHCI removeSharedDevice(device); |